note 48731 deleted from function.array-search by felipe
| From: | felipe@php.net | Date: | Sun, 10 Feb 2008 13:10:16 +0000 |
| Subject: | note 48731 deleted from function.array-search by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-135957@lists.php.net to get a copy of this message | ||
Note Submitter: stew at initiative dot uk dot com(stewart boutcher)
----
Not to labour the point too much, but here's another, slightly less verbose multi dimensional
recursive function...
function array_key_exists_recursive($needle,$haystack) {
foreach($haystack as $key=>$val) {
if(is_array($val)) { if(array_key_exists_recursive($needle,$val)) return 1; }
elseif($val == $needle) return 1;
}
return 0;
}