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\"
This will work too.
function in_array_r($item , $array){ return preg_match('/"'.preg_quote($item, '/').'"/i' , json_encode($array)); }
Usage:
if(in_array_r($item , $array)){ // found! }