note 13875 deleted from function.array-reverse by didou
| From: | didou@php.net | Date: | Wed, 21 May 2003 13:39:52 +0000 |
| Subject: | note 13875 deleted from function.array-reverse by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-48738@lists.php.net to get a copy of this message | ||
Note Submitter: bear@datasys.org
----
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;
}
}