I am trying to check if any values out or array $a1 are present in array $a2 in PHP...
$a1 = array(
"a"=>"red",
"b"=>"green",
"c"=>"blue",
"d"=>"yellow"
);
$a2 = array(
"b"=>"green",
"c"=>"blue",
);
I have tried to compare using in_array like this...
if (in_array($a1, $a2)) {
echo "Match found";
}
But this is not working, I think this is because in_array does not support checking an array against an array. What is the correct method?
array_diff()