Comparing NAN

../_images/compare_nan.png

PHP does not compare NAN values: it always fails, even if the source is the same.

Depending on the context, NAN becomes the string 'NAN', or the integer 0.

Since PHP 8.1, the engine emits a warning to signal it: this is good, and helps spotting such mistakes.

And, in the end, no one uses NAN anyway.

See Also

PHP Features