I have two array
$a = array(\'a\',\'b\');
$b = array(\'a\',\'1\',\'2\',\'3\',\'4\');
How to checks any value of array $a exists in array $b
if (count(array_intersect($array1, $array2)) === 0) {
// No values from array1 are in array 2
} else {
// There is at least one value from array1 present in array2
}
http://php.net/manual/en/function.array-intersect.php
Probably worth nothing that, in all likelihood, under the hood, a loop is used.