| // +----------------------------------------------------------------------+ // // $Id: array_search.php,v 1.2 2007-01-18 09:02:27 kostja Exp $ // /** * Replace array_search() * * @category PHP * @package PHP_Compat * @link http://php.net/array_search * @author Aidan Lister * @author Thiemo Mättig (http://maettig.com/) * @version $Revision: 1.2 $ * @since PHP 4.0.5 * @require PHP 4.0.1 (trigger_error) */ if (!function_exists('array_search')) { function array_search ($needle, $haystack, $strict = false) { if (!is_array($haystack)) { trigger_error("array_search() Wrong datatype for second argument", E_USER_WARNING); return false; } foreach ($haystack as $key => $value) { if ($strict ? $value === $needle : $value == $needle) { return $key; } } return false; } } ?>