3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo() { return (throw new \Exception(__FUNCTION__)); } try { foo(); } catch (\Exception $e) { var_export($e->getMessage()); }
Output for 8.1.23 - 8.1.27, 8.2.10 - 8.2.17, 8.3.0 - 8.3.4
'foo'
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.6
Parse error: syntax error, unexpected 'throw' (T_THROW) in /in/6AfAD on line 4
Process exited with code 255.

preferences:
75.68 ms | 401 KiB | 51 Q