3v4l.org

run code in 300+ PHP versions simultaneously
<?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 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Warning: Undefined variable $lorem in /in/08JkW on line 11 2: Undefined variable $ipsum in /in/08JkW on 15 2: Undefined variable $dolor in /in/08JkW on 22 -fail: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated 2: Undefined variable $sit in /in/08JkW on 34 2: Undefined variable $amet in /in/08JkW on 38 Warning: Undefined variable $consectepture in /in/08JkW on line 42
Output for 8.0.0 - 8.0.30
Warning: Undefined variable $lorem in /in/08JkW on line 11 2: Undefined variable $ipsum in /in/08JkW on 15 2: Undefined variable $dolor in /in/08JkW on 22 -fail: preg_match(): Compilation failed: quantifier does not follow a repeatable item at offset 4 2: Undefined variable $sit in /in/08JkW on 34 2: Undefined variable $amet in /in/08JkW on 38 Warning: Undefined variable $consectepture in /in/08JkW on line 42
Output for 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
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: quantifier does not follow a repeatable item 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 7.3.32 - 7.3.33
8: Undefined variable: ipsum in /in/08JkW on 15 8: Undefined variable: dolor in /in/08JkW on 22 -fail: preg_match(): Compilation failed: quantifier does not follow a repeatable item at offset 4 8: Undefined variable: sit in /in/08JkW on 34 8: Undefined variable: amet in /in/08JkW on 38
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33
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 5.1.0 - 5.1.6, 5.2.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.3.11, 4.4.0 - 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.

preferences:
299.12 ms | 401 KiB | 460 Q