kartik\helpers\Enum::inArray PHP 메소드

inArray() 공개 정적인 메소드

Example: ~~~ if (Enum::inArray('apple', ['apple', 'mango', 'banana'])) { echo 'apple exists'; } ~~~
public static inArray ( string $needle, array $haystack ) : boolean
$needle string the value to search
$haystack array the array to scan
리턴 boolean
    public static function inArray($needle, $haystack)
    {
        $flippedHaystack = array_flip($haystack);
        return isset($flippedHaystack[$needle]);
    }