Is Not A NAN¶
<?php
var_dump(NAN === NAN); // false
var_dump(is_nan(NAN)); // true
?>
NAN is a special PHP constant, which represents not-a-number: it is returned when a math function cannot calculate a value because it is out of its domain of application. For example, acos(3) returns NAN, because cos() produces values between -1 and 1.
One special situation with NAN is that it is always different from anything. So, it cannot even compare to itself.
Also, NAN is a float.
See Also¶
PHP Features¶
Last updated: 14 July 2026