src/BigFloat.php
public static function inRange($value, $lower, $upper, $lowerExclusive = false, $upperExclusive = false)
    {
        if (!static::is($value) || !static::is($lower) || !static::is($upper)) {
            throw new \InvalidArgumentException(
                "The \$value, \$lower and \$upper parameters must be of type float"
                . " (or string representing a big float)."
            );
        }

        $lowerLimit = min($lower, $upper);
        if (!(($lowerExclusive) ? $lowerLimit < $value : $lowerLimit <= $value)) {
            return false;
        }

        $upperLimit = max($lower, $upper);
        if (!(($upperExclusive) ? $upperLimit > $value : $upperLimit >= $value)) {
            return false;
        }

        return true;
    }
public static function inRange($value, $lower, $upper, $lowerExclusive = false, $upperExclusive = false)
    {
        if (!static::is($value) || !static::is($lower) || !static::is($upper)) {
            throw new \InvalidArgumentException(
                "The \$value, \$lower and \$upper parameters must be of type float"
                . " (or string representing a big float)."
            );
        }

        $lowerLimit = min($lower, $upper);
        if (!(($lowerExclusive) ? $lowerLimit < $value : $lowerLimit <= $value)) {
            return false;
        }

        $upperLimit = max($lower, $upper);
        if (!(($upperExclusive) ? $upperLimit > $value : $upperLimit >= $value)) {
            return false;
        }

        return true;
    }
public static function inRange ( $ value , $ lower , $ upper , $ lowerExclusive = false , $ upperExclusive = false ) { if ( ! static :: is ( $ value ) || ! static :: is ( $ lower ) || ! static :: is ( $ upper ) ) { throw new \ InvalidArgumentException ( "The \$value, \$lower and \$upper parameters must be of type float" . " (or string representing a big float)." ) ; } $ lowerLimit = min ( $ lower , $ upper ) ; if ( ! ( ( $ lowerExclusive ) ? $ lowerLimit < $ value : $ lowerLimit <= $ value ) ) { return false ; } $ upperLimit = max ( $ lower , $ upper ) ; if ( ! ( ( $ upperExclusive ) ? $ upperLimit > $ value : $ upperLimit >= $ value ) ) { return false ; } return true ; }
Tests if an integer is in a range.

Tests if a value is in a range. The function will correct the limits if inverted. The tested range
can be set to have its lower and upper limits inclusive (bounds closed) or exclusive (bounds opened) using
the $lowerExclusive and $upperExclusive parameters (all possible variations: ]a,b[ -or- ]a,b] -or- [a,b[
-or- [a,b]).

@param float|string $value          The value to test in range.
@param float|string $lower          The range's lower limit.
@param float|string $upper          The range's upper limit.
@param bool         $lowerExclusive Whether the lower bound is exclusive.
@param bool         $upperExclusive Whether the upper bound is exclusive.

@return bool Whether the value is in the given range given the bounds configurations.
@throws \InvalidArgumentException
@SuppressWarnings(PHPMD.BooleanArgumentFlag)
Tests if an integer is in a range .