I have 2 arrays and am looking to find a value inside 1 of the arrays using PHP.
I realise I'd have to use the PHP explode
function but I'm afraid that's where my skills end.
My function would compare the values of both arrays and if it finds any $needle
values inside $haystack
, it would return them inside $found
. It could potentially find more than one, so perhaps $found
should be an array too?
$needle = "Swimming,Landscaping,Gardening,Bricklaying,3D Modelling";
$haystack = "Football,Rugby,Landscaping,3D Modelling";
$found = magicFunction($needle,$haystick);
// $found['0'] = "Landscaping";
// $found['1'] = "3D Modelling";
Does this make sense?
Many thanks for any pointers with this.