is_infinite()

is_infinite() — Checks whether a float is infinite.

Built-in function of PHP 8.5. The manual lists it as available in PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.

Signature

is_infinite(float $num): bool

Parameters

ParameterTypeWhat it takes
$numfloatThe float to check

Return value

true if num is either INF or -INF, else false.

Example

A runnable snippet:

$inf = 1e308 * 2; var_dump($inf, is_infinite($inf)); $negative_inf = -$inf; var_dump($negative_inf, is_infinite($negative_inf));

Output:

float(INF) bool(true) float(-INF) bool(true)

See also

is_finite(), is_nan()

All PHP 8.5 built-in functions

Reference card built from the PHP manual page is_infinite() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.