3v4l.org

run code in 300+ PHP versions simultaneously
<?php class C { } class A { public function foo(/* C */ $c) { echo 'c'; } } class B extends A { public function foo(C $c) { echo 'd'; } } $c = new C(); $b = new B(); echo $b->foo($c);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.31, 8.2.0 - 8.2.27, 8.3.0 - 8.3.15, 8.4.1 - 8.4.2
Fatal error: Declaration of B::foo(C $c) must be compatible with A::foo($c) in /in/s6f92 on line 14
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Warning: Declaration of B::foo(C $c) should be compatible with A::foo($c) in /in/s6f92 on line 14 d
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33
Warning: Declaration of B::foo(C $c) should be compatible with A::foo($c) in /in/s6f92 on line 17 d
Output for 5.6.0 - 5.6.40
Strict Standards: Declaration of B::foo() should be compatible with A::foo($c) in /in/s6f92 on line 17 d

preferences:
44.53 ms | 409 KiB | 5 Q