note 75411 deleted from function.array-key-exists by danbrown
| From: | danbrown@php.net | Date: | Tue, 21 Jul 2009 13:04:18 +0000 |
| Subject: | note 75411 deleted from function.array-key-exists by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-158538@lists.php.net to get a copy of this message | ||
Note Submitter: alishahnovin at hotmail dot com
----
Seems the array_key_exists can't find a key in a multidimensional array...
Here's my fix...
<?php
function multi_array_key_exists($needle, $haystack) {
foreach ($haystack as $key=>$value) {
if ($needle==$key) {
return true;
}
if (is_array($value)) {
multi_array_key_exists($needle, $value);
}
}
return false;
}
?>