PHP.nl

is_nan

is_nan

Checks whether a float is NAN

bool **is_nan** float $num

Returns whether the given is (). num``NAN

is returned from mathematical operations that are undefined,

for example when passing parameters outside of function’s input domain. The square root () is only defined for positive numbers, passing a negative number will result in . Other examples of operations returning are dividing by and any operation involving an existing value. NAN``sqrt``NAN``NAN``INF``INF``NAN

Opmerking: > Despite its name of , is a valid value of type float. NAN

Let op: > does not compare equal to . To check whether a float is , must be used. Checking will not work. NAN``NAN``NAN``is_nan``$float === NAN

numThe float to check

true if is , else false. num``NAN

Voorbeeld: example

<?php
$nan = sqrt(-1);

var_dump($nan, is_nan($nan));
?>
float(NAN)
bool(true)

is_finite``is_infinite