note 13875 added to function.array-reverse.php
| From: | bear at datasys dot org | Date: | Sat, 07 Jul 2001 18:30:10 +0000 |
| Subject: | note 13875 added to function.array-reverse.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-15073@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;
}
}
http://www.php.net/manual/en/function.array-reverse.php