note 47134 deleted from function.in-array by felipe

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
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;	
}
?>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.