3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ALL); echo __LINE__; $foo = function() { return 'OK'; // throw new \Exception('foo'); return 'NOT OK'; } $return = $foo(); echo $return; try { $foo = function() { return 'OK'; // throw new \Exception('foo'); return 'NOT OK'; } $return = $foo(); echo $return; } catch (\Exception $e) { var_dump($e); }
Output for 5.4.0 - 5.4.26
Parse error: syntax error, unexpected '$return' (T_VARIABLE) in /in/gLfvU on line 12
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_VARIABLE in /in/gLfvU on line 12
Process exited with code 255.

preferences:
189.53 ms | 1395 KiB | 63 Q