3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class MyException extends Exception { public function __construct($message, $code=0, Exception $previous = null) { if (version_compare(PHP_VERSION, '5.3.0') >= 0) { parent::__construct($message,$code,$previous); } else { parent::__construct($message,$code); } } public function __toString() { return __CLASS__. ":[{$this->code}]:{$this->message}\n"; } } throw new MyException("Foo");
Output for 5.1.0 - 7.1.0
Fatal error: Uncaught MyException:[0]:Foo thrown in /in/rquX5 on line 19
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Fatal error: Argument 3 must not be null in /in/rquX5 on line 5
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/rquX5 on line 5
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, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/rquX5 on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/rquX5 on line 5
Process exited with code 255.