3v4l.org

run code in 300+ PHP versions simultaneously
<?php function f($b) { if ($b) throw new Exception("e"); } function g($b) { try { f($b); } catch (Exception $e) { } var_dump($e); } g(false); g(true);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Warning: Undefined variable $e in /in/tFsFi on line 17 NULL object(Exception)#1 (7) { ["message":protected]=> string(1) "e" ["string":"Exception":private]=> string(0) "" ["code":protected]=> int(0) ["file":protected]=> string(9) "/in/tFsFi" ["line":protected]=> int(5) ["trace":"Exception":private]=> array(2) { [0]=> array(4) { ["file"]=> string(9) "/in/tFsFi" ["line"]=> int(12) ["function"]=> string(1) "f" ["args"]=> array(1) { [0]=> bool(true) } } [1]=> array(4) { ["file"]=> string(9) "/in/tFsFi" ["line"]=> int(21) ["function"]=> string(1) "g" ["args"]=> array(1) { [0]=> bool(true) } } } ["previous":"Exception":private]=> NULL }
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.25, 7.4.27 - 7.4.33
Notice: Undefined variable: e in /in/tFsFi on line 17 NULL object(Exception)#1 (7) { ["message":protected]=> string(1) "e" ["string":"Exception":private]=> string(0) "" ["code":protected]=> int(0) ["file":protected]=> string(9) "/in/tFsFi" ["line":protected]=> int(5) ["trace":"Exception":private]=> array(2) { [0]=> array(4) { ["file"]=> string(9) "/in/tFsFi" ["line"]=> int(12) ["function"]=> string(1) "f" ["args"]=> array(1) { [0]=> bool(true) } } [1]=> array(4) { ["file"]=> string(9) "/in/tFsFi" ["line"]=> int(21) ["function"]=> string(1) "g" ["args"]=> array(1) { [0]=> bool(true) } } } ["previous":"Exception":private]=> NULL }
Output for 7.3.32 - 7.3.33, 7.4.26
NULL object(Exception)#1 (7) { ["message":protected]=> string(1) "e" ["string":"Exception":private]=> string(0) "" ["code":protected]=> int(0) ["file":protected]=> string(9) "/in/tFsFi" ["line":protected]=> int(5) ["trace":"Exception":private]=> array(2) { [0]=> array(4) { ["file"]=> string(9) "/in/tFsFi" ["line"]=> int(12) ["function"]=> string(1) "f" ["args"]=> array(1) { [0]=> bool(true) } } [1]=> array(4) { ["file"]=> string(9) "/in/tFsFi" ["line"]=> int(21) ["function"]=> string(1) "g" ["args"]=> array(1) { [0]=> bool(true) } } } ["previous":"Exception":private]=> NULL }
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.28
Notice: Undefined variable: e in /in/tFsFi on line 17 NULL object(Exception)#1 (7) { ["message":protected]=> string(1) "e" ["string":"Exception":private]=> string(0) "" ["code":protected]=> int(0) ["file":protected]=> string(9) "/in/tFsFi" ["line":protected]=> int(5) ["trace":"Exception":private]=> array(2) { [0]=> array(4) { ["file"]=> string(9) "/in/tFsFi" ["line"]=> int(12) ["function"]=> string(1) "f" ["args"]=> array(1) { [0]=> bool(true) } } [1]=> array(4) { ["file"]=> string(9) "/in/tFsFi" ["line"]=> int(21) ["function"]=> string(1) "g" ["args"]=> array(1) { [0]=> &bool(true) } } } ["previous":"Exception":private]=> NULL }
Output for 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
Notice: Undefined variable: e in /in/tFsFi on line 17 NULL object(Exception)#1 (6) { ["message:protected"]=> string(1) "e" ["string:private"]=> string(0) "" ["code:protected"]=> int(0) ["file:protected"]=> string(9) "/in/tFsFi" ["line:protected"]=> int(5) ["trace:private"]=> array(2) { [0]=> array(4) { ["file"]=> string(9) "/in/tFsFi" ["line"]=> int(12) ["function"]=> string(1) "f" ["args"]=> array(1) { [0]=> bool(true) } } [1]=> array(4) { ["file"]=> string(9) "/in/tFsFi" ["line"]=> int(21) ["function"]=> string(1) "g" ["args"]=> array(1) { [0]=> &bool(true) } } } }
Output for 5.0.4
Notice: Undefined variable: e in /in/tFsFi on line 17 NULL object(Exception)#1 (6) { ["message:protected"]=> string(1) "e" ["string:private"]=> string(0) "" ["code:protected"]=> int(0) ["file:protected"]=> string(9) "/in/tFsFi" ["line:protected"]=> int(5) ["trace:private"]=> array(3) { [0]=> array(3) { ["file"]=> string(9) "/in/tFsFi" ["line"]=> int(5) ["function"]=> string(1) "f" } [1]=> array(4) { ["file"]=> string(9) "/in/tFsFi" ["line"]=> int(12) ["function"]=> string(1) "f" ["args"]=> array(1) { [0]=> bool(true) } } [2]=> array(4) { ["file"]=> string(9) "/in/tFsFi" ["line"]=> int(21) ["function"]=> string(1) "g" ["args"]=> array(1) { [0]=> &bool(true) } } } }
Output for 5.0.3
Notice: Undefined variable: e in /in/tFsFi on line 17 NULL object(Exception)#1 (6) { ["message:protected"]=> string(1) "e" ["string:private"]=> string(0) "" ["code:protected"]=> int(0) ["file:protected"]=> string(9) "/in/tFsFi" ["line:protected"]=> int(5) ["trace:private"]=> array(3) { [0]=> array(3) { ["file"]=> string(9) "/in/tFsFi" ["line"]=> int(5) ["function"]=> string(1) "f" } [1]=> array(4) { ["file"]=> string(9) "/in/tFsFi" ["line"]=> int(12) ["function"]=> string(1) "f" ["args"]=> array(1) { [0]=> bool(true) } } [2]=> array(4) { ["file"]=> string(9) "/in/tFsFi" ["line"]=> int(21) ["function"]=> string(1) "g" ["args"]=> array(1) { [0]=> &bool(true) } } } }
Output for 5.0.0 - 5.0.2
Notice: Undefined variable: e in /in/tFsFi on line 17 NULL object(Exception)#1 (6) { ["message:protected"]=> string(1) "e" ["string:private"]=> string(0) "" ["code:protected"]=> int(0) ["file:protected"]=> string(9) "/in/tFsFi" ["line:protected"]=> int(5) ["trace:private"]=> array(2) { [0]=> array(4) { ["file"]=> string(9) "/in/tFsFi" ["line"]=> int(12) ["function"]=> string(1) "f" ["args"]=> array(1) { [0]=> bool(true) } } [1]=> array(4) { ["file"]=> string(9) "/in/tFsFi" ["line"]=> int(21) ["function"]=> string(1) "g" ["args"]=> array(1) { [0]=> &bool(true) } } } }
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_NEW in /in/tFsFi on line 5
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/tFsFi on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/tFsFi on line 5
Process exited with code 255.

preferences:
257.64 ms | 401 KiB | 399 Q