note 71129 added to function.array-search
| From: | evert_18 at hotmail dot com | Date: | Mon, 13 Nov 2006 14:18:39 +0000 |
| Subject: | note 71129 added to function.array-search | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-119664@lists.php.net to get a copy of this message | ||
This function can search in multidimensional arrays, no mather how multidimensional the array is!
<?php
function array_search(&$array,$needle)
{
foreach($array as $key => $value)
{
if($value == $needle || $key == $needle)
return(true);
else
if(is_array($value))
$this->search($value,$needle);
else
return(false);
}
}
?>
----
Server IP: 83.137.20.120
Probable Submitter: 217.194.107.215
----
Manual Page -- http://www.php.net/manual/en/function.array-search.php
Edit -- https://master.php.net/note/edit/71129
Del: integrated -- https://master.php.net/note/delete/71129/integrated
Del: useless -- https://master.php.net/note/delete/71129/useless
Del: bad code -- https://master.php.net/note/delete/71129/bad+code
Del: spam -- https://master.php.net/note/delete/71129/spam
Del: non-english -- https://master.php.net/note/delete/71129/non-english
Del: in docs -- https://master.php.net/note/delete/71129/in+docs
Del: other reasons-- https://master.php.net/note/delete/71129
Reject -- https://master.php.net/note/reject/71129
Search -- https://master.php.net/manage/user-notes.php