The array_key_exists() function checks an array for a specified key, and returns true if the key exists and false if the key does not exist.
Syntax:array_key_exists(key,array)
In above syntax,"key" specifies the key and "array" specifies an array
<?php
$a=array("Apple"=>"fruit","Mango");
if (array_key_exists("Mango",$a))
{
echo "Key exists!";
}
else
{
echo "Key does not exist!";
}
?>
Output:
Others
Languages
Frameworks
Web / Design
Mobile Technology
Sql & Technology
R4R