note 47134 deleted from function.in-array by felipe
| From: | felipe@php.net | Date: | Sun, 30 Dec 2007 18:54:54 +0000 |
| Subject: | note 47134 deleted from function.in-array by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-134477@lists.php.net to get a copy of this message | ||
Note Submitter: langewisch at lakoma dot com
----
Hi,
if you want to search a value in a mutidimensional array try this.
Cu
Christoph
-------------------------------
<?
function in_multi_array($search_str, $multi_array)
{
if(!is_array($multi_array))
return 0;
if(in_array($search_str, $multi_array))
return 1;
foreach($multi_array as $key => $value)
{
if(is_array($value))
{
$found = in_multi_array($search_str, $value);
if($found)
return 1;
}
else
{
if($key==$search_str)
return 1;
}
}
return 0;
}
?>