note 110120 added to function.array-search
| From: | sunelbe at gmail dot com | Date: | Fri, 21 Sep 2012 12:19:05 +0000 |
| Subject: | note 110120 added to function.array-search | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-190947@lists.php.net to get a copy of this message | ||
hey i have a easy multidimensional array search function
function search($array, $key, $value)
{
$results = array();
if (is_array($array))
{
if (isset($array[$key]) && $array[$key] == $value)
$results[] = $array;
foreach ($array as $subarray)
$results = array_merge($results, search($subarray, $key, $value));
}
return $results;
}
----
Server IP: 69.147.83.199
Probable Submitter: 110.234.150.51
----
Manual Page -- http://www.php.net/manual/en/function.array-search.php
Edit -- https://master.php.net/note/edit/110120
Del: integrated -- https://master.php.net/note/delete/110120/integrated
Del: useless -- https://master.php.net/note/delete/110120/useless
Del: bad code -- https://master.php.net/note/delete/110120/bad+code
Del: spam -- https://master.php.net/note/delete/110120/spam
Del: non-english -- https://master.php.net/note/delete/110120/non-english
Del: in docs -- https://master.php.net/note/delete/110120/in+docs
Del: other reasons-- https://master.php.net/note/delete/110120
Reject -- https://master.php.net/note/reject/110120
Search -- https://master.php.net/manage/user-notes.php