3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $columns = 6; $rows = 4; $x = $columns; $y = 1; $value = 1; for($i = 0; $i < $columns * $rows; $i++) { if ($i % $columns == 0) echo PHP_EOL; echo $value, ' '; if ($i > 0 && $i % $x == 0) { $y++; $x = $columns / $y; $value++; } }
based on lSLi5
Output for 7.0.0 - 7.2.0
1 1 1 1 1 1 1 2 2 2 3 4 5 6 7 Fatal error: Uncaught DivisionByZeroError: Modulo by zero in /in/tFpXv:12 Stack trace: #0 {main} thrown in /in/tFpXv on line 12
Process exited with code 255.
Output for 5.3.19 - 5.6.28
1 1 1 1 1 1 1 2 2 2 3 4 5 6 7 Warning: Division by zero in /in/tFpXv on line 12 8 Warning: Division by zero in /in/tFpXv on line 12 9 Warning: Division by zero in /in/tFpXv on line 12 10 Warning: Division by zero in /in/tFpXv on line 12 11 Warning: Division by zero in /in/tFpXv on line 12 12 Warning: Division by zero in /in/tFpXv on line 12 13 Warning: Division by zero in /in/tFpXv on line 12 14 Warning: Division by zero in /in/tFpXv on line 12 15 Warning: Division by zero in /in/tFpXv on line 12 16 Warning: Division by zero in /in/tFpXv on line 12