public static function multiple($check, array $options = [], $caseInsensitive = false)
    {
        $defaults = ['in' => null, 'max' => null, 'min' => null];
        $options += $defaults;

        $check = array_filter((array)$check, function ($value) {
            return ($value || is_numeric($value));
        });
        if (empty($check)) {
            return false;
        }
        if ($options['max'] && count($check) > $options['max']) {
            return false;
        }
        if ($options['min'] && count($check) < $options['min']) {
            return false;
        }
        if ($options['in'] && is_array($options['in'])) {
            if ($caseInsensitive) {
                $options['in'] = array_map('mb_strtolower', $options['in']);
            }
            foreach ($check as $val) {
                $strict = !is_numeric($val);
                if ($caseInsensitive) {
                    $val = mb_strtolower($val);
                }
                if (!in_array((string)$val, $options['in'], $strict)) {
                    return false;
                }
            }
        }

        return true;
    }
public static function multiple($check, array $options = [], $caseInsensitive = false)
    {
        $defaults = ['in' => null, 'max' => null, 'min' => null];
        $options += $defaults;

        $check = array_filter((array)$check, function ($value) {
            return ($value || is_numeric($value));
        });
        if (empty($check)) {
            return false;
        }
        if ($options['max'] && count($check) > $options['max']) {
            return false;
        }
        if ($options['min'] && count($check) < $options['min']) {
            return false;
        }
        if ($options['in'] && is_array($options['in'])) {
            if ($caseInsensitive) {
                $options['in'] = array_map('mb_strtolower', $options['in']);
            }
            foreach ($check as $val) {
                $strict = !is_numeric($val);
                if ($caseInsensitive) {
                    $val = mb_strtolower($val);
                }
                if (!in_array((string)$val, $options['in'], $strict)) {
                    return false;
                }
            }
        }

        return true;
    }
public static function multiple ( $ check , array $ options = [ ] , $ caseInsensitive = false ) { $ defaults = [ 'in' => null , 'max' => null , 'min' => null ] ; $ options += $ defaults ; $ check = array_filter ( ( array ) $ check , function ( $ value ) { return ( $ value || is_numeric ( $ value ) ) ; } ) ; if ( empty ( $ check ) ) { return false ; } if ( $ options [ 'max' ] && count ( $ check ) > $ options [ 'max' ] ) { return false ; } if ( $ options [ 'min' ] && count ( $ check ) < $ options [ 'min' ] ) { return false ; } if ( $ options [ 'in' ] && is_array ( $ options [ 'in' ] ) ) { if ( $ caseInsensitive ) { $ options [ 'in' ] = array_map ( 'mb_strtolower' , $ options [ 'in' ] ) ; } foreach ( $ check as $ val ) { $ strict = ! is_numeric ( $ val ) ; if ( $ caseInsensitive ) { $ val = mb_strtolower ( $ val ) ; } if ( ! in_array ( ( string ) $ val , $ options [ 'in' ] , $ strict ) ) { return false ; } } } return true ; }
Validates a multiple select. Comparison is case sensitive by default.

Valid Options

- in => provide a list of choices that selections must be made from
- max => maximum number of non-zero choices that can be made
- min => minimum number of non-zero choices that can be made

@param array $check Value to check
@param array $options Options for the check.
@param bool $caseInsensitive Set to true for case insensitive comparison.
@return bool Success
Validates a multiple select . Comparison is case sensitive by default .