Reputation: 14798
I have two arrays : array("blue", "yellow")
and array("blue", "green", "red", "purple")
. Is there a function that will check if those two arrays have at least one element value in common ("blue") - just return true or false.
Upvotes: 21
Views: 9307
Reputation: 14479
$array1 = array("blue", "yellow");
$array2 = array("blue", "green", "red");
return count(array_intersect($array1, $array2)) > 0;
Upvotes: 49