Array_key_exists ()
The PHP array_key_exists () function checks whether a given key name or index exists in an array, returns TRUE if it exists, or returns FALSE.
Grammar:
the bool Array_key_exists (mixed key, array search) parameter key is the given key name or index, and can be any value that can be indexed as an array.
The array_key_exists () function can also be used for objects.
Example:
<?php
$arr _a = array (' ID ' => 1, ' name ' => ' admin ');
if (array_key_exists (' name ', $arr _a)) {
echo ' key name exists in array $arr _a ';
} else {
echo ' key name does not exist in array $arr _a '; c10/>}
?>
The example output is as follows:
The key name name exists in the array $arr _a the array_key_exists () function returns TRUE for an array element that has a value of NULL. To check whether an array element is NULL, use Isset ().
The above PHP array_key_exists check the key name or whether the index exists in the array of the implementation method is small series to share all the content, hope to give you a reference, but also hope that we support cloud habitat community.