note 93605 deleted from function.array-key-exists by danbrown
| From: | danbrown@php.net | Date: | Fri, 18 Sep 2009 15:48:58 +0000 |
| Subject: | note 93605 deleted from function.array-key-exists by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-160833@lists.php.net to get a copy of this message | ||
Note Submitter: patrick at pwfisher dot com
----
Here's a simplified but equivalent version of the recursive search by
Benjamin*removethis*BeckATgmx.de:
<?php
function array_key_exists_r($needle, $haystack){
if (array_key_exists($needle, $haystack) return true;
foreach ($haystack as $v) {
if (is_array($v) && array_key_exists_r($needle, $v)) return true;
}
return false;
}
?>