check key in array php

PHP
// Here's our fruity array
$fruits = ['apple', 'pear', 'banana'];

// Use it in an `if` statement
if (array_key_exists("banana", $fruits)) {
 // Do stuff because `banana` exists
}

// Store it for later use
$exists = array_key_exists("peach", $fruits);function findKey($array, $keySearch)
{
    foreach ($array as $key => $item) {
        if ($key == $keySearch) {
            echo 'yes, it exists';
            return true;
        } elseif (is_array($item) && findKey($item, $keySearch)) {
            return true;
        }
    }
    return false;
}
<?php
$search_array = array('first' => null, 'second' => 4);

// returns false
isset($search_array['first']);

// returns true
array_key_exists('first', $search_array);
?>


Source

Also in PHP: