3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $count = 5; $last = 4; foreach (range(-5, 4, 1) as $v) { print $v . ': ' .$v % $count . ' ' . (($v % $count) + $count) % $count . "\n"; }
based on G5Te0
Output for 5.0.0 - 7.1.0
-5: 0 0 -4: -4 1 -3: -3 2 -2: -2 3 -1: -1 4 0: 0 0 1: 1 1 2: 2 2 3: 3 3 4: 4 4
Output for 4.3.0 - 4.3.10, 4.4.0 - 4.4.9
Warning: Wrong parameter count for range() in /in/SdGLh on line 6 Warning: Invalid argument supplied for foreach() in /in/SdGLh on line 6
Output for 4.3.11
Warning: Wrong parameter count for range() in /in/SdGLh on line 6