3v4l.org

run code in 300+ PHP versions simultaneously
<?php MyTrueException extends \Exception() { } MyFalseException extends \Exception() { } function doSomething($var) { ($var) ? throw new MyTrueException() ? throw new MyFalseException(); } try { doSomething(true); } catch (MyTrueException) { echo 'got true'; } catch (MyFalseException) { echo 'got false'; }
Output for 5.4.0 - 5.4.25, 5.5.0 - 5.5.9
Parse error: syntax error, unexpected 'extends' (T_EXTENDS) in /in/1fXdp on line 3
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_EXTENDS in /in/1fXdp on line 3
Process exited with code 255.

preferences:
186.71 ms | 1395 KiB | 72 Q