note 90822 added to function.array-search
| From: | tony dot peter at wanadoo dot fr | Date: | Mon, 11 May 2009 19:53:38 +0000 |
| Subject: | note 90822 added to function.array-search | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-154473@lists.php.net to get a copy of this message | ||
A simple recursive array_search function :
<?php
function recursive_array_search($needle,$haystack) {
foreach($haystack as $key=>$value) {
$current_key=$key;
if($needle===$value OR (is_array($value) && recursive_array_search($needle,$value)))
{
return $current_key;
}
}
return false;
}
----
Server IP: 69.147.83.197
Probable Submitter: 90.6.25.170
----
Manual Page -- http://www.php.net/manual/en/function.array-search.php
Edit -- https://master.php.net/note/edit/90822
Del: integrated -- https://master.php.net/note/delete/90822/integrated
Del: useless -- https://master.php.net/note/delete/90822/useless
Del: bad code -- https://master.php.net/note/delete/90822/bad+code
Del: spam -- https://master.php.net/note/delete/90822/spam
Del: non-english -- https://master.php.net/note/delete/90822/non-english
Del: in docs -- https://master.php.net/note/delete/90822/in+docs
Del: other reasons-- https://master.php.net/note/delete/90822
Reject -- https://master.php.net/note/reject/90822
Search -- https://master.php.net/manage/user-notes.php