3v4l.org

run code in 300+ PHP versions simultaneously
<?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
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.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.3.11, 4.4.0 - 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

preferences:
215.18 ms | 1387 KiB | 123 Q