3v4l.org

run code in 300+ PHP versions simultaneously
<?php header("Content-type:text/plain; charset=utf-8"); error_reporting(E_ALL); ini_set('display_errors', 1); class A { public function f(array $array) { var_dump($array); } } class B extends A { public function f(A $a, array $b) { var_dump($b); } } $a = new A(); $a->f([1, 2, 3]); $b = new B(); $b->f($a, []);
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: Declaration of B::f(A $a, array $b) must be compatible with A::f(array $array) in /in/lpJfU on line 18
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Warning: Declaration of B::f(A $a, array $b) should be compatible with A::f(array $array) in /in/lpJfU on line 18 Warning: Cannot modify header information - headers already sent by (output started at /in/lpJfU:22) in /in/lpJfU on line 3 array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) } array(0) { }
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.33
Warning: Declaration of B::f(A $a, array $b) should be compatible with A::f(array $array) in /in/lpJfU on line 22 Warning: Cannot modify header information - headers already sent by (output started at /in/lpJfU:22) in /in/lpJfU on line 3 array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) } array(0) { }
Output for 5.4.35 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.28
Strict Standards: Declaration of B::f() should be compatible with A::f(array $array) in /in/lpJfU on line 22 Warning: Cannot modify header information - headers already sent by (output started at /in/lpJfU:22) in /in/lpJfU on line 3 array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) } array(0) { }
Output for 5.4.0 - 5.4.34
Strict Standards: Declaration of B::f() should be compatible with A::f(array $array) in /in/lpJfU on line 22 Warning: Cannot modify header information - headers already sent by (output started at /in/lpJfU:22) in /in/lpJfU on line 3 Warning: ini_set() has been disabled for security reasons in /in/lpJfU on line 6 array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) } array(0) { }
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29
Strict Standards: Declaration of B::f() should be compatible with that of A::f() in /in/lpJfU on line 22 Parse error: syntax error, unexpected '[', expecting ')' in /in/lpJfU on line 26
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_ARRAY, expecting '&' or T_VARIABLE in /in/lpJfU on line 10
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/lpJfU on line 10
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 T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/lpJfU on line 10
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/lpJfU on line 10
Process exited with code 255.

preferences:
245.86 ms | 401 KiB | 358 Q