note 126271 deleted from function.array-search by crell
| From: | crell@php.net | Date: | Thu, 31 Mar 2022 20:36:48 +0000 |
| Subject: | note 126271 deleted from function.array-search by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-217944@lists.php.net to get a copy of this message | ||
Note Submitter: moe at moose dot at
----
My function get_key_in_array() needed some improvement:
<?PHP
// search keymap $s in array $a
function get_key_in_array($s, $a)
{
if(is_array($s) && isset($a[key($s)]) && is_array($a[key($s)])) {
return get_key_in_array(reset($s), $a[key($s)]);
} else {
if(is_array($s)) $s=reset($s);
return (is_string($s)||is_int($s))&&isset($a[$s])?$a[$s]:false;
}
}
?>