3v4l.org

run code in 300+ PHP versions simultaneously
<?php function diff($this, $that){ $diff = $this-$that; while($diff < -180) $diff += 360; while($diff > 180) $diff -= 360; echo rad2deg($diff).PHP_EOL; } diff(359,1);//2 diff(-90,90); //180

preferences:
40.2 ms | 402 KiB | 5 Q