note 79323 deleted from function.array-search by ezyang
| From: | ezyang@php.net | Date: | Wed, 21 Nov 2007 03:01:13 +0000 |
| Subject: | note 79323 deleted from function.array-search by ezyang | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-132455@lists.php.net to get a copy of this message | ||
Note Submitter: Chris
Reason: useless
----
//Another recursive array_search that works better for me
function array_search_recursive($needle, $haystack, $a=0, $nodes_temp=array(),
$nodes_found=array()){
global $nodes_found;
foreach ($haystack as $key1=>$value1) {
$nodes_temp[$a] = $key1;
if (is_array($value1)){
$a++;
array_search_recursive($needle, $value1, $a, $nodes_temp, $nodes_found);
}
else if ($value1 === $needle){
$nodes_found[] = $nodes_temp;
}
}
$a = $a-1;
return $nodes_found;
}