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