note 38684 deleted from function.array-search by nlopess
| From: | nlopess@php.net | Date: | Fri, 02 Jan 2004 20:08:01 +0000 |
| Subject: | note 38684 deleted from function.array-search by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-62809@lists.php.net to get a copy of this message | ||
Note Submitter: tanyasnm@hotmail.com
----
<?php
function MDArraySearch ($searchValue, $haystack) {
/* This function searches for a value in a multidimensional array;
an array within an array within an array...
It asumes all values in an array are atomic values xor non-atomic values
This function is more faster than others.
@author Tanya Fedorov, Uruguay <tanyasnm@hotmail.com>
@param $searchValue What you want to search for
@param $haystack What you want to search in
@return boolean
*/
if ( array_search($searchValue, $haystack) ) {
return true;
} else {
if ( is_array($haystack[0]) ) {
foreach($haystack as $actualHaystack) {
if ( MDArraySearch ($searchValue, $actualHaystack) )
return true;
}
} else {
return false;
}
}
}
?>