1
2<?php
3$search_array = array('first' => null, 'second' => 4);
4
5// returns false
6isset($search_array['first']);
7
8// returns true
9array_key_exists('first', $search_array);
10?>
11
12
1function findKey($array, $keySearch)
2{
3 foreach ($array as $key => $item) {
4 if ($key == $keySearch) {
5 echo 'yes, it exists';
6 return true;
7 } elseif (is_array($item) && findKey($item, $keySearch)) {
8 return true;
9 }
10 }
11 return false;
12}
13