To check key in the array, we can use array_key_exists().

$item=array("name"=>"umesh","class"=>"mca");
if (array_key_exists("name",$item))
{
   echo "Key is exists";
}
else
{
   echo "Key does not exist!";
}

 

 

BY Best Interview Question ON 07 Apr 2020