3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = (int) INF; $n = (int) pow(2,64); var_dump( $a/$n ); // floating point div with non-zero value echo $a - ($n * (int) ($a/$n) ),"\n"; // INF but s/b NAN echo fmod(INF,pow(2,64)),"\n"; // NAN correct! echo INF % pow(2,64); // integer div b/c % so pow(2,64) becomes 0
based on 2ZjTO
Output for 7.0.0 - 7.2.0
Warning: Division by zero in /in/UfYZb on line 5 float(NAN) Warning: Division by zero in /in/UfYZb on line 7 0 NAN Fatal error: Uncaught DivisionByZeroError: Modulo by zero in /in/UfYZb:12 Stack trace: #0 {main} thrown in /in/UfYZb on line 12
Process exited with code 255.
Output for 5.5.24 - 5.6.28
Warning: Division by zero in /in/UfYZb on line 5 bool(false) Warning: Division by zero in /in/UfYZb on line 7 -9223372036854775808 NAN Warning: Division by zero in /in/UfYZb on line 12
Output for 5.3.20 - 5.4.45
Warning: Division by zero in /in/UfYZb on line 5 bool(false) Warning: Division by zero in /in/UfYZb on line 7 0 NAN Warning: Division by zero in /in/UfYZb on line 12