note 80692 added to function.array-search
| From: | pmmout at gmail dot com | Date: | Tue, 29 Jan 2008 12:55:54 +0000 |
| Subject: | note 80692 added to function.array-search | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-135539@lists.php.net to get a copy of this message | ||
MultiArray find function.
After some time unsuccessful looking for algorithm to find a string in multidimensional array I
wrote one:
function multidimArrayLocate($array, $text){
foreach($array as $key => $arrayValue){
if (is_array($arrayValue)){
if ($key == $text) $arrayResult[$key] = $arrayValue;
$temp[$key] = multidimArrayLocate($arrayValue, $text);
if ($temp[$key]) $arrayResult[$key] = $temp[$key];
}
else{
if ($key == $text) $arrayResult[$key] = $arrayValue;
}
}
return $arrayResult;
}
----
Server IP: 194.8.30.16
Probable Submitter: 213.58.212.68
----
Manual Page -- http://www.php.net/manual/en/function.array-search.php
Edit -- https://master.php.net/note/edit/80692
Del: integrated -- https://master.php.net/note/delete/80692/integrated
Del: useless -- https://master.php.net/note/delete/80692/useless
Del: bad code -- https://master.php.net/note/delete/80692/bad+code
Del: spam -- https://master.php.net/note/delete/80692/spam
Del: non-english -- https://master.php.net/note/delete/80692/non-english
Del: in docs -- https://master.php.net/note/delete/80692/in+docs
Del: other reasons-- https://master.php.net/note/delete/80692
Reject -- https://master.php.net/note/reject/80692
Search -- https://master.php.net/manage/user-notes.php