note 87227 added to function.array-search
| From: | AlirezaEliaderani at osu1 dot php dot net | Date: | Tue, 25 Nov 2008 18:42:50 +0000 |
| Subject: | note 87227 added to function.array-search | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-146955@lists.php.net to get a copy of this message | ||
this function return a multidimensional path of recursively founded $needle in a multidimensional
$haystack
<?php
function array_search_recursive($needle, $haystack){
$path=array();
foreach($haystack as $id => $val)
{
if($val === $needle)
$path[]=$id;
else if(is_array($val)){
$found=array_search_recursive($needle, $val);
if(count($found)>0){
$path[$id]=$found;
}
}
}
return $path;
}
?>
----
Server IP: 79.132.192.3
Probable Submitter: 91.184.68.36
----
Manual Page -- http://www.php.net/manual/en/function.array-search.php
Edit -- https://master.php.net/note/edit/87227
Del: integrated -- https://master.php.net/note/delete/87227/integrated
Del: useless -- https://master.php.net/note/delete/87227/useless
Del: bad code -- https://master.php.net/note/delete/87227/bad+code
Del: spam -- https://master.php.net/note/delete/87227/spam
Del: non-english -- https://master.php.net/note/delete/87227/non-english
Del: in docs -- https://master.php.net/note/delete/87227/in+docs
Del: other reasons-- https://master.php.net/note/delete/87227
Reject -- https://master.php.net/note/reject/87227
Search -- https://master.php.net/manage/user-notes.php