class Numbers (View source)

Methods

bool
integer(mixed $data, int|null $min = null, int|null $max = null)

Tests whether the passed item is an integer.

bool
number(mixed $data, int|float|null $min = null, int|float|null $max = null)

Tests whether the passed item is an integer or a floating point number.

Details

bool integer(mixed $data, int|null $min = null, int|null $max = null)

Tests whether the passed item is an integer.

Since this is frequently used by the form helper we're not checking whether the TYPE of data is an integer, but whether the passed argument represents a valid text/string version of an integer.

Parameters

mixed $data
int|null $min

the minimum acceptable value of the integer (pass NULL to not check the minimum value)

int|null $max

the maximum acceptable value of the integer (pass NULL to not check the maximum value)

Return Value

bool

bool number(mixed $data, int|float|null $min = null, int|float|null $max = null)

Tests whether the passed item is an integer or a floating point number.

Since this is frequently used by the form helper we're not checking whether the TYPE of data is an integer or a float, but whether the passed argument represents a valid text/string version of an integer or a float.

Parameters

mixed $data
int|float|null $min

the minimum acceptable value of the number (pass NULL to not check the minimum value)

int|float|null $max

the maximum acceptable value of the number (pass NULL to not check the maximum value)

Return Value

bool