Interval
class Interval
Tests if a given number belongs to a given math interval.
An interval can represent a finite set of numbers:
{1,2,3,4}
An interval can represent numbers between two numbers:
[1, +Inf] ]-1,2[
The left delimiter can be [ (inclusive) or ] (exclusive). The right delimiter can be [ (exclusive) or ] (inclusive). Beside numbers, you can use -Inf and +Inf for the infinite.
Methods
static bool | test(int $number, string $interval) Tests if the given number is in the math interval. | |
static string | getIntervalRegexp() Returns a Regexp that matches valid intervals. |
Details
static bool test(int $number, string $interval)
Tests if the given number is in the math interval.
Parameters
int | $number | A number |
string | $interval | An interval |
Return Value
bool |
Exceptions
InvalidArgumentException |
static string getIntervalRegexp()
Returns a Regexp that matches valid intervals.
Return Value
string | A Regexp (without the delimiters) |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/4.0/Symfony/Component/Translation/Interval.html