3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function f($errno, $errstr, $errfile, $errline ) { $args = func_get_args(); print_r($args); return true; } function exception_error_handler($errno, $errstr, $errfile, $errline ) { throw new ErrorException($errstr); } ++$lorem; set_error_handler("exception_error_handler"); ++$foo; set_error_handler("exception_error_handler"); try { preg_match("/foo(+/", null); echo "+valid\n"; } catch (ErrorException $e) { echo "-fail: ", $e->getMessage(), "\n"; } restore_error_handler(); ++$bar; restore_error_handler(); ++$ipsum;
Output for 7.0.0 - 7.1.0
Notice: Undefined variable: lorem in /in/vXSX1 on line 12 Fatal error: Uncaught ErrorException: Undefined variable: foo in /in/vXSX1:9 Stack trace: #0 /in/vXSX1(16): exception_error_handler(8, 'Undefined varia...', '/in/vXSX1', 16, Array) #1 {main} thrown in /in/vXSX1 on line 9
Process exited with code 255.
Output for hhvm-3.12.0
Notice: Undefined variable: lorem in /in/vXSX1 on line 12 Fatal error: Uncaught exception 'ErrorException' with message 'Undefined variable: foo' in /in/vXSX1:9 Stack trace: #0 /in/vXSX1(16): exception_error_handler() #1 {main}
Process exited with code 255.
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.3.0 - 5.6.28
Notice: Undefined variable: lorem in /in/vXSX1 on line 12 Fatal error: Uncaught exception 'ErrorException' with message 'Undefined variable: foo' in /in/vXSX1:9 Stack trace: #0 /in/vXSX1(16): exception_error_handler(8, 'Undefined varia...', '/in/vXSX1', 16, Array) #1 {main} thrown in /in/vXSX1 on line 9
Process exited with code 255.
Output for 5.1.0 - 5.2.17
Notice: Undefined variable: lorem in /in/vXSX1 on line 12 Fatal error: Uncaught exception 'ErrorException' with message 'Undefined variable: foo' in /in/vXSX1:9 Stack trace: #0 /in/vXSX1(16): exception_error_handler() #1 {main} thrown in /in/vXSX1 on line 9
Process exited with code 255.
Output for 5.0.4 - 5.0.5
Notice: Undefined variable: lorem in /in/vXSX1 on line 12 Fatal error: Class 'ErrorException' not found in /in/vXSX1 on line 9
Process exited with code 255.
Output for 5.0.0 - 5.0.3
Notice: Undefined variable: lorem in /in/vXSX1 on line 12 Fatal error: Class 'ErrorException' not found in /in/vXSX1 on line 9
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_NEW in /in/vXSX1 on line 9
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_NEW in /in/vXSX1 on line 9
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/vXSX1 on line 9
Process exited with code 255.