PHP function that checks if the given key or index exists in the array
The
array_key_exists()
checks if the given key or index exists in the array.
<?php
$search_array = array('first' => 1, 'second' => 4);
if (array_key_exists('first', $search_array)) {
echo "1";
}
?>
The output will be
1