3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function bar() { throw new Exception ('foobar'); } } $a = new Foo; try{ $a->bar(); } catch( $e ) { echo $e->getMessage(); }
Output for 5.4.0 - 5.4.8
Parse error: syntax error, unexpected '$e' (T_VARIABLE), expecting identifier (T_STRING) or namespace (T_NAMESPACE) or \\ (T_NS_SEPARATOR) in S8jjA on line 14
Process exited with code 255.
Output for 5.3.0 - 5.3.18
Parse error: syntax error, unexpected T_VARIABLE, expecting T_STRING or T_NAMESPACE or T_NS_SEPARATOR in S8jjA on line 14
Process exited with code 255.

preferences:
168.46 ms | 1395 KiB | 35 Q