note 31280 added to function.array-search
| From: | richard at richard-sumilang dot com | Date: | Wed, 16 Apr 2003 08:59:21 +0000 |
| Subject: | note 31280 added to function.array-search | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-46675@lists.php.net to get a copy of this message | ||
/**
* Search an array recursivly
*
* This function will search an array recursivly
* till it finds what it is looking for. An array
* within an array within an array within array
* is all good :-)
*
* @author Richard Sumilang <richard@richard-sumilang.com>
* @param string $needle What are you searching for?
* @param array $haystack What you want to search in
* @return boolean
* @access public
*/
function array_search_r($needle, $haystack){
foreach($haystack as $value){
if(is_array($value))
$match=array_search_r($needle, $value);
if($value==$needle)
$match=1;
if($match)
return 1;
}
return 0;
}
--
http://www.php.net/manual/en/function.array-search.php
http://master.php.net/manage/user-notes.php?action=edit+31280
http://master.php.net/manage/user-notes.php?action=delete+31280
http://master.php.net/manage/user-notes.php?action=reject+31280