3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $ox = 10; $oy = 10; $x = 10; $y = 15; $sx = ($ox < $x)?1:($ox==$x?0:-1); $sy = ($oy < $y)?1:($oy==$y?0:-1); var_dump($sx,$sy); //Test collisions for each cell along deplacement for($dx = $ox+$sx; $sx*$dx <= $sx*$x; $dx += $sx){ for($dy = $oy+$sy; $sy*$dy <= $sy*$y; $dy += $sy){ var_dump(array($dx,$dy)); } }