3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function f($errno, $errstr, $errfile, $errline ) { echo $errno, ": ", $errstr, " in ", $errfile, " on ", $errline, "\n"; return true; } function exception_error_handler($errno, $errstr, $errfile, $errline ) { throw new ErrorException($errstr); } ++$lorem; set_error_handler('f'); ++$ipsum; set_error_handler(function ($errno, $errstr, $errfile, $errline) { echo $errno, ": ", $errstr, " in ", $errfile, " on ", $errline, "\n"; return true; }); ++$dolor; 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(); ++$sit; restore_error_handler(); ++$amet; restore_error_handler(); ++$consectepture;
Output for 5.3.0 - 5.6.28, 7.0.0 - 7.1.0
Notice: Undefined variable: lorem in /in/08JkW on line 11 8: Undefined variable: ipsum in /in/08JkW on 15 8: Undefined variable: dolor in /in/08JkW on 22 -fail: preg_match(): Compilation failed: nothing to repeat at offset 4 8: Undefined variable: sit in /in/08JkW on 34 8: Undefined variable: amet in /in/08JkW on 38 Notice: Undefined variable: consectepture in /in/08JkW on line 42
Output for hhvm-3.12.0
Notice: Undefined variable: lorem in /in/08JkW on line 11 8: Undefined variable: ipsum in /in/08JkW on 15 8: Undefined variable: dolor in /in/08JkW on 22 -fail: preg_match() expects parameter 2 to be string, null given 8: Undefined variable: sit in /in/08JkW on 34 8: Undefined variable: amet in /in/08JkW on 38 Notice: Undefined variable: consectepture in /in/08JkW on line 42
Output for hhvm-3.10.0
Notice: Undefined variable: lorem in /in/08JkW on line 11 8: Undefined variable: ipsum in /in/08JkW on 15 8: Undefined variable: dolor in /in/08JkW on 22 -fail: Compilation failed: nothing to repeat at offset 4 8: Undefined variable: sit in /in/08JkW on 34 8: Undefined variable: amet in /in/08JkW on 38 Notice: Undefined variable: consectepture in /in/08JkW on line 42
Output for 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /in/08JkW on line 17
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_FUNCTION, expecting ')' in /in/08JkW on line 17
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_NEW in /in/08JkW on line 8
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/08JkW on line 8
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/08JkW on line 8
Process exited with code 255.