3v4l.org

run code in 500+ PHP versions simultaneously
<?php class A { } class B { public function m(A $a = NULL, &$n) { echo "B.m";} }; class C extends B { public function m( $a ) { echo "C.m";} }; $b = new B(); $b->m(new A(), $b); $c = new C(); $c->m(new A(), $b);
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Warning: Declaration of C::m($a) should be compatible with B::m(?A $a, &$n) in /in/9C7DU on line 5 B.mC.m
Output for 5.6.0 - 5.6.30
Strict Standards: Declaration of C::m() should be compatible with B::m(A $a, &$n) in /in/9C7DU on line 5 B.mC.m
Output for 7.0.6 - 7.0.20
Warning: Declaration of C::m($a) should be compatible with B::m(A $a = NULL, &$n) in /in/9C7DU on line 5 B.mC.m
Output for 7.0.0 - 7.0.5
Warning: Declaration of C::m($a) should be compatible with B::m(A $a, &$n) in /in/9C7DU on line 5 B.mC.m
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.34, 8.3.0 - 8.3.30
Fatal error: Declaration of C::m($a) must be compatible with B::m(?A $a, &$n) in /in/9C7DU on line 5
Process exited with code 255.
Output for 8.4.1 - 8.4.18
Deprecated: B::m(): Implicitly marking parameter $a as nullable is deprecated, the explicit nullable type must be used instead in /in/9C7DU on line 4 Fatal error: Declaration of C::m($a) must be compatible with B::m(?A $a, &$n) in /in/9C7DU on line 5
Process exited with code 255.
Output for 8.5.0 - 8.5.3
Deprecated: B::m(): Implicitly marking parameter $a as nullable is deprecated, the explicit nullable type must be used instead in /in/9C7DU on line 4 Fatal error: Declaration of C::m($a) must be compatible with B::m(?A $a, &$n) in /in/9C7DU on line 5 Stack trace: #0 {main}
Process exited with code 255.

preferences:
43.22 ms | 1157 KiB | 18 Q