3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function diff($this, $that){ $this = deg2rad($this); $that = deg2rad($that); if($this<0)$this += M_PI_2; if($that<0)$that += M_PI_2; $diff = abs($this-$that ); $diff = min( M_PI_2 - $diff, $diff); echo rad2deg($diff) .PHP_EOL; } diff(-1,1);//2 diff(-90,90);//180 diff(-179,179);//2
based on vM8fe
Output for 5.0.0 - 5.4.32
Fatal error: Cannot re-assign $this in /in/qOtdI on line 3
Process exited with code 255.
Output for 4.3.10 - 4.4.1, 4.4.3 - 4.4.9
2 0 -178
Output for 4.4.2
//22 0 -178
Output for 4.3.0 - 4.3.9
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/qOtdI on line 11 2PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/qOtdI on line 11 0PHP_EOL Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/qOtdI on line 11 -178PHP_EOL