3v4l.org

run code in 300+ PHP versions simultaneously
<?php function call_debug_backtrace($errno, $errstr) { static $call = 0; $call++; echo "call {$call}: {$errstr}\n"; $bt = debug_backtrace(); $args = $bt[1]["args"]; foreach ($args as $k => $v) { $n = $k + 1; echo "call {$call}: argument {$n} is '{$v}'\n"; $args[$k] = "altered {$call}:{$n}"; $bt2 = debug_backtrace(); if ($bt2[1]["args"][$k] === $args[$k]) { echo "call {$call}: updated argument {$n} to '{$args[$k]}'\n"; } } } set_error_handler("call_debug_backtrace"); function foo($a, stdClass $b, stdClass $c) { var_dump($a); var_dump($b); var_dump($c); } foo(1, 2, 3);
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
Fatal error: Uncaught TypeError: foo(): Argument #2 ($b) must be of type stdClass, int given, called in /in/7B3jB on line 28 and defined in /in/7B3jB:22 Stack trace: #0 /in/7B3jB(28): foo(1, 2, 3) #1 {main} thrown in /in/7B3jB on line 22
Process exited with code 255.
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Fatal error: Uncaught TypeError: Argument 2 passed to foo() must be an instance of stdClass, int given, called in /in/7B3jB on line 28 and defined in /in/7B3jB:22 Stack trace: #0 /in/7B3jB(28): foo(1, 2, 3) #1 {main} thrown in /in/7B3jB on line 22
Process exited with code 255.
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33
Fatal error: Uncaught TypeError: Argument 2 passed to foo() must be an instance of stdClass, integer given, called in /in/7B3jB on line 28 and defined in /in/7B3jB:22 Stack trace: #0 /in/7B3jB(28): foo(1, 2, 3) #1 {main} thrown in /in/7B3jB on line 22
Process exited with code 255.
Output for 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
call 1: Argument 2 passed to foo() must be an instance of stdClass, integer given, called in /in/7B3jB on line 28 and defined call 1: argument 1 is '1' call 1: updated argument 1 to 'altered 1:1' call 1: argument 2 is '2' call 1: updated argument 2 to 'altered 1:2' call 1: argument 3 is '3' call 1: updated argument 3 to 'altered 1:3' call 2: Argument 3 passed to foo() must be an instance of stdClass, string given, called in /in/7B3jB on line 28 and defined call 2: argument 1 is 'altered 1:1' call 2: updated argument 1 to 'altered 2:1' call 2: argument 2 is 'altered 1:2' call 2: updated argument 2 to 'altered 2:2' call 2: argument 3 is 'altered 1:3' call 2: updated argument 3 to 'altered 2:3' int(1) string(11) "altered 1:2" string(11) "altered 2:3"
Output for 5.1.0 - 5.1.6
Fatal error: Argument 2 passed to foo() must be an object of class stdClass, called in /in/7B3jB on line 28 and defined in /in/7B3jB on line 22
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Fatal error: Argument 2 must be an object of class stdClass in /in/7B3jB on line 22
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting '&' or T_VARIABLE or T_CONST in /in/7B3jB on line 22
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_STRING, expecting '&' or T_VARIABLE or T_CONST in /in/7B3jB on line 22
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `'&'' or `T_VARIABLE' or `T_CONST' in /in/7B3jB on line 22
Process exited with code 255.

preferences:
345.84 ms | 401 KiB | 459 Q