note 49122 deleted from function.array-search by didou
| From: | didou@php.net | Date: | Mon, 17 Jan 2005 17:13:56 +0000 |
| Subject: | note 49122 deleted from function.array-search by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-83507@lists.php.net to get a copy of this message | ||
Note Submitter: Swoog DOT News A@T LaPoste DOT NET_DELME
----
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 false;
}
?>
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 !