public function range($subject, $min, $max) : bool
    {
        if (!is_int($min) && !is_float($min)) {
            throw new InvalidArgumentException('Arg min type[' . Utils::getType($min) . '] is not integer or float.');
        }
        if (!is_int($max) && !is_float($max)) {
            throw new InvalidArgumentException('Arg max type[' . Utils::getType($max) . '] is not integer or float.');
        }
        if ($max < $min) {
            throw new InvalidArgumentException('Arg max[' .  $max . '] cannot be less than arg min[' .  $min . '].');
        }
        if ($subject === null) {
            return false;
        }
        return $subject >= $min && $subject <= $max;
    }
public function range($subject, $min, $max) : bool
    {
        if (!is_int($min) && !is_float($min)) {
            throw new InvalidArgumentException('Arg min type[' . Utils::getType($min) . '] is not integer or float.');
        }
        if (!is_int($max) && !is_float($max)) {
            throw new InvalidArgumentException('Arg max type[' . Utils::getType($max) . '] is not integer or float.');
        }
        if ($max < $min) {
            throw new InvalidArgumentException('Arg max[' .  $max . '] cannot be less than arg min[' .  $min . '].');
        }
        if ($subject === null) {
            return false;
        }
        return $subject >= $min && $subject <= $max;
    }
public function range ( $ subject , $ min , $ max ) : bool { if ( ! is_int ( $ min ) && ! is_float ( $ min ) ) { throw new InvalidArgumentException ( 'Arg min type[' . Utils :: getType ( $ min ) . '] is not integer or float.' ) ; } if ( ! is_int ( $ max ) && ! is_float ( $ max ) ) { throw new InvalidArgumentException ( 'Arg max type[' . Utils :: getType ( $ max ) . '] is not integer or float.' ) ; } if ( $ max < $ min ) { throw new InvalidArgumentException ( 'Arg max[' . $ max . '] cannot be less than arg min[' . $ min . '].' ) ; } if ( $ subject === null ) { return false ; } return $ subject >= $ min && $ subject <= $ max ; }
Numeric range.

May produce false negative if (at least) two of the args are float;
comparing floats is inherently imprecise.

@see Validate::number()
@see Validate::integer()
@see Validate::float()
@see Validate::numeric()
@see Validate::digit()

@param mixed $subject
@param int|float $min
Stringed number is not accepted.
@param int|float $max
Stringed number is not accepted.

@return bool

@throws InvalidArgumentException
Arg min not integer or float.
Arg max not integer or float.
Arg max less than arg min.
Numeric range .