note 49123 deleted from function.array-search by danbrown

From: Date: Wed, 29 Apr 2009 13:05:25 +0000
Subject: note 49123 deleted from function.array-search by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-153993@lists.php.net to get a copy of this message
Note Submitter: Swoog DOT News A@T LaPoste DOT NET_DELME ---- [[Excuse me but the return line of the precedent fuction had an error :( :( :( ]] Just For Say I Had Reworked the function Object_Search in Object_Search_All : <?php function object_search_all(&$needle, &$haystack, $strict=false) { $results = array(); if(!is_array($haystack)) return NULL; foreach($haystack as $k => $v) { if(($strict && $needle===$v) || (!$strict && $needle==$v)) $results[] = $k; } return $results == array() ? false : $results; } ?> it's return _NULL_ if $haystack isn't an array; it's retrun _false_ if there is no $needle in haystack it work also with not numerics array (thanks to a _foreach_ ) Be Happy ;) ! :D Bye !

« previous php.notes (#153993) next »