note 79323 added to function.array-search
| From: | Chris at osu1 dot php dot net | Date: | Wed, 21 Nov 2007 01:15:56 +0000 |
| Subject: | note 79323 added to function.array-search | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-132451@lists.php.net to get a copy of this message | ||
//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;
}
----
Server IP: 66.207.199.35
Probable Submitter: 67.68.114.134
----
Manual Page -- http://www.php.net/manual/en/function.array-search.php
Edit -- https://master.php.net/note/edit/79323
Del: integrated -- https://master.php.net/note/delete/79323/integrated
Del: useless -- https://master.php.net/note/delete/79323/useless
Del: bad code -- https://master.php.net/note/delete/79323/bad+code
Del: spam -- https://master.php.net/note/delete/79323/spam
Del: non-english -- https://master.php.net/note/delete/79323/non-english
Del: in docs -- https://master.php.net/note/delete/79323/in+docs
Del: other reasons-- https://master.php.net/note/delete/79323
Reject -- https://master.php.net/note/reject/79323
Search -- https://master.php.net/manage/user-notes.php