3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class Foo { function breakShit() { return 'derp'; } function bar($bar) { $bar = $this->breakShit(); throw Exception; } } (new Foo())->bar('herp');
based on 2kr2J
Output for 7.0.0 - 7.1.0
Notice: Use of undefined constant Exception - assumed 'Exception' in /in/SXm7Y on line 10 Fatal error: Uncaught Error: Can only throw objects in /in/SXm7Y:10 Stack trace: #0 /in/SXm7Y(14): Foo->bar('derp') #1 {main} thrown in /in/SXm7Y on line 10
Process exited with code 255.
Output for hhvm-3.12.0
Notice: Use of undefined constant Exception - assumed 'Exception' in /in/SXm7Y on line 10 Fatal error: Exceptions must implement the Throwable interface. in /in/SXm7Y on line 10
Process exited with code 255.
Output for hhvm-3.10.0
Notice: Use of undefined constant Exception - assumed 'Exception' in /in/SXm7Y on line 10 Fatal error: Exceptions must be valid objects derived from the Exception base class in /in/SXm7Y on line 10
Process exited with code 255.
Output for 5.4.0 - 5.6.28
Notice: Use of undefined constant Exception - assumed 'Exception' in /in/SXm7Y on line 10 Fatal error: Can only throw objects in /in/SXm7Y on line 10
Process exited with code 255.
Output for 5.1.0 - 5.3.29
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/SXm7Y on line 14
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/SXm7Y on line 14
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING in /in/SXm7Y on line 10
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING in /in/SXm7Y on line 10
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/SXm7Y on line 10
Process exited with code 255.