public static function inArray($needle, $haystack) { $flippedHaystack = array_flip($haystack); return isset($flippedHaystack[$needle]); }