PHP array_key_exists()


array_key_exists(needle, array) function checks whether a key exists or not in an associative array.

<?PHP
$arr=array("apple"=>"carbon","rice"=>"carbon","nuts"=>"fat","meat"=>"protein");
if (array_key_exists("rice",$arr)) echo "rice included";
//rice included
?>