I use in_array() to check whether a value exists in an array like below,
in_array()
$a = array(\"Mac\", \"NT\", \"Irix\", \"Linux\"); if (in_array(\"Irix\"
you can use like this
$result = array_intersect($array1, $array2); print_r($result);
http://php.net/manual/tr/function.array-intersect.php