note 79325 deleted from function.array-search by danbrown

From: Date: Wed, 29 Apr 2009 12:57:31 +0000
Subject: note 79325 deleted from function.array-search by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-153974@lists.php.net to get a copy of this message
Note Submitter: Chris ---- <?php //Another recursive array_search that works better for me function array_search_recursive($needle, $haystack, $a=0, $nodes_temp=array()){ global $nodes_found; foreach ($haystack as $key1=>$value1) { $nodes_temp[$a] = $key1; if (is_array($value1)){ $a++; array_search_recursive($needle, $value1, $a, $nodes_temp); } else if ($value1 === $needle){ $nodes_found[] = $nodes_temp; } } $a--; return $nodes_found; } ?>

« previous php.notes (#153974) next »