I noticed that it does not work for the following code:
$array1 = array(1, 2); $array2 = array(1, 2, 3, 4, 5); echo in_array($array1, $array2) ? 'Found' : 'Lost';
Is this expected behavior? If so can you help me better understand why? (perhaps I am just tired from working all day and it's obvious)
I am trying to identify if an array contains any of the values from the given search array.
I read the in_array manual an it shows an example with a multidimensional array but not a simple array.
Would it just be more efficient to loop over the search array and manually check the values? (This is what I am about to resort to)
Thanks for any help on the matter or just fixing my stupid.


Sign In
Create Account


Back to top









