3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php var_dump(NAN); // float NAN var_dump(NAN == NAN); // boolean true var_dump(NAN === NAN); // boolean true var_dump(is_nan(NAN)); // boolean true var_dump(NAN == 12); // boolean true var_dump(NAN === 12); // boolean false var_dump(is_nan(12)); // boolean false var_dump(NAN == 12.4); // boolean true var_dump(NAN === 12.4); // boolean true var_dump(is_nan(12.4)); // boolean false var_dump(NAN == NULL); // boolean true var_dump(NAN === NULL); // boolean false var_dump(is_nan(NULL)); // boolean false
Output for 4.3.6 - 5.0.5, 5.1.1 - 7.1.0
float(NAN) bool(false) bool(false) bool(true) bool(false) bool(false) bool(false) bool(false) bool(false) bool(false) bool(false) bool(false) bool(false)
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/Rp1FB on line 19
Process exited with code 255.
Output for 4.3.0 - 4.3.5
Notice: Use of undefined constant NAN - assumed 'NAN' in /in/Rp1FB on line 3 string(3) "NAN" Notice: Use of undefined constant NAN - assumed 'NAN' in /in/Rp1FB on line 5 Notice: Use of undefined constant NAN - assumed 'NAN' in /in/Rp1FB on line 5 bool(true) Notice: Use of undefined constant NAN - assumed 'NAN' in /in/Rp1FB on line 6 Notice: Use of undefined constant NAN - assumed 'NAN' in /in/Rp1FB on line 6 bool(true) Notice: Use of undefined constant NAN - assumed 'NAN' in /in/Rp1FB on line 7 Warning: is_nan() expects parameter 1 to be double, string given in /in/Rp1FB on line 7 NULL Notice: Use of undefined constant NAN - assumed 'NAN' in /in/Rp1FB on line 9 bool(false) Notice: Use of undefined constant NAN - assumed 'NAN' in /in/Rp1FB on line 10 bool(false) bool(false) Notice: Use of undefined constant NAN - assumed 'NAN' in /in/Rp1FB on line 13 bool(false) Notice: Use of undefined constant NAN - assumed 'NAN' in /in/Rp1FB on line 14 bool(false) bool(false) Notice: Use of undefined constant NAN - assumed 'NAN' in /in/Rp1FB on line 17 bool(false) Notice: Use of undefined constant NAN - assumed 'NAN' in /in/Rp1FB on line 18 bool(false) bool(false)