note 45516 deleted from function.in-array by danbrown
| From: | danbrown@php.net | Date: | Mon, 08 Jun 2009 21:46:11 +0000 |
| Subject: | note 45516 deleted from function.in-array by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-156523@lists.php.net to get a copy of this message | ||
Note Submitter: <Marco Stumper> phpundhtml at web dot de
----
Here is a function to search a string in multidimensional Arrays(you can have so much dimensions as
you like:
function in_array_multi($needle, $haystack)
{
$found = false;
foreach($haystack as $value) if((is_array($value) && in_array_multi($needle, $value)) ||
$value == $needle) $found = true;
return $found;
}
It is a little shorter than the other function.