Usephul

Var

Table of Contents

Enums

Type
Possible types as returned by {@see gettype()}.

Constants

ZERO_TOLERANCE  = 9.999999999999999E-12
Default error tolerance.

Functions

is_closed_resource()  : bool
Finds whether the given variable is a resource that has been closed.
is_enum_case()  : bool
Finds whether the given value is an enum case.
is_negative_int()  : ($value is negative-int ? true : false)
Find whether a variable is an integer and less than zero.
is_non_empty_string()  : ($value is non-empty-string ? true : false)
Find whether a variable is a non-empty string.
is_non_negative_int()  : bool
Find whether a variable is an integer and not less than zero.
is_non_positive_int()  : bool
Find whether a variable is an integer and not greater than zero.
is_non_zero_int()  : bool
Find whether a variable is an integer and not zero.
is_number()  : number ? true : false)
Find whether a variable is a number (either an integer or a float).
is_positive_int()  : ($value is positive-int ? true : false)
Find whether a variable is an integer and greater than zero.
is_zero()  : bool
Finds whether the given number is (sufficiently close to) 0.

Constants

ZERO_TOLERANCE

Default error tolerance.

public mixed ZERO_TOLERANCE = 9.999999999999999E-12

Functions

is_closed_resource()

Finds whether the given variable is a resource that has been closed.

is_closed_resource(mixed $value) : bool
Parameters
$value : mixed

The variable being evaluated.

Return values
bool

is_enum_case()

Finds whether the given value is an enum case.

is_enum_case(mixed $value) : bool
Parameters
$value : mixed
Return values
bool

is_negative_int()

Find whether a variable is an integer and less than zero.

is_negative_int(mixed $value) : ($value is negative-int ? true : false)
Parameters
$value : mixed

The variable being evaluated.

Return values
($value is negative-int ? true : false)

Returns true if value is a negative integer, false otherwise.

is_non_empty_string()

Find whether a variable is a non-empty string.

is_non_empty_string(mixed $value) : ($value is non-empty-string ? true : false)
Parameters
$value : mixed

The variable being evaluated.

Tags
phpstan-assert-if-true

non-empty-string $value

Return values
($value is non-empty-string ? true : false)

Returns true if value is a non-empty string, false otherwise.

is_non_negative_int()

Find whether a variable is an integer and not less than zero.

is_non_negative_int(mixed $value) : bool
Parameters
$value : mixed

The variable being evaluated.

Tags
phpstan-assert-if-true

non-negative-int $value

Return values
bool

is_non_positive_int()

Find whether a variable is an integer and not greater than zero.

is_non_positive_int(mixed $value) : bool
Parameters
$value : mixed

The variable being evaluated.

Tags
phpstan-assert-if-true

non-positive-int $value

Return values
bool

is_non_zero_int()

Find whether a variable is an integer and not zero.

is_non_zero_int(mixed $value) : bool
Parameters
$value : mixed

The variable being evaluated.

Tags
phpstan-assert-if-true

non-zero-int $value

Return values
bool

is_number()

Find whether a variable is a number (either an integer or a float).

is_number(mixed $value) : number ? true : false)
Parameters
$value : mixed

The variable being evaluated.

Tags
phpstan-assert-if-true

number $value

Return values
number ? true : false)

Returns true if value is an integer or float, false otherwise.

is_positive_int()

Find whether a variable is an integer and greater than zero.

is_positive_int(mixed $value) : ($value is positive-int ? true : false)
Parameters
$value : mixed

The variable being evaluated.

Tags
phpstan-assert-if-true

positive-int $value

Return values
($value is positive-int ? true : false)

Returns true if value is a positive integer, false otherwise.

is_zero()

Finds whether the given number is (sufficiently close to) 0.

is_zero(int|float $value[, float|null $tolerance = ZERO_TOLERANCE ]) : bool
Parameters
$value : int|float

The number being evaluated.

$tolerance : float|null = ZERO_TOLERANCE

Tolerance allowed when evaluating the number.

Tags
phpstan-assert-if-true

($value is int ? non-positive-int&non-negative-int : float) $value

Return values
bool

Returns true if value is (sufficiently close to) 0, false otherwise.


        
On this page

Search results