note 31280 deleted from function.array-search by peehaa

From: Date: Fri, 07 Apr 2017 10:34:24 +0000
Subject: note 31280 deleted from function.array-search by peehaa
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-208999@lists.php.net to get a copy of this message
Note Submitter: richard at richard-sumilang dot com ---- <?php /** * 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; } ?>

« previous php.notes (#208999) next »