is_nan()
is_nan() — Checks whether a float is NAN.
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.
What it does
Returns whether the given num is NAN (Not A Number).
Signature
is_nan(float $num): bool
Parameters
| Parameter | Type | What it takes |
|---|---|---|
| $num | float | The float to check |
Return value
true if num is NAN, else false.
Example
A runnable snippet:
$nan = sqrt(-1); var_dump($nan, is_nan($nan));
Output:
float(NAN) bool(true)
See also
All PHP 8.5 built-in functions
Reference card built from the PHP manual page is_nan() (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.