note 13876 deleted from function.array-search by jimw
| From: | jimw@php.net | Date: | Thu, 25 Oct 2001 23:15:17 +0000 |
| Subject: | note 13876 deleted from function.array-search by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-19448@lists.php.net to get a copy of this message | ||
This code should work, even if you upgrade to a php version that has the function implemented
if (!function_exists("array_search")) {
function array_search ($needle, $haystack, $strict = FALSE) {
foreach($haystack as $key => $value) {
if ($strict) {
if ($value === $needle) return $key;
} else {
if ($value == $needle) return $key;
}
}
return FALSE;
}
}