3v4l.org

run code in 500+ PHP versions simultaneously
<?php class A {} class B { public function b(A $a) {} } class C extends B { public function b($a) {} } $a = new C();
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.36, 8.3.0 - 8.3.37, 8.4.1 - 8.4.28, 8.5.0 - 8.5.12, 5.4.0 - 5.4.3
Output for 7.4.27 - 7.4.33, 7.4.0 - 7.4.25, 7.2.0 - 7.2.34, 7.3.0 - 7.3.31
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; B has a deprecated constructor in /in/UMNlC on line 5 Fatal error: Uncaught ArgumentCountError: Too few arguments to function B::b(), 0 passed in /in/UMNlC on line 13 and exactly 1 expected in /in/UMNlC:6 Stack trace: #0 /in/UMNlC(13): B->b() #1 {main} thrown in /in/UMNlC on line 6
Process exited with code 255.
Output for 7.4.26, 7.3.32 - 7.3.33
Fatal error: Uncaught ArgumentCountError: Too few arguments to function B::b(), 0 passed in /in/UMNlC on line 13 and exactly 1 expected in /in/UMNlC:6 Stack trace: #0 /in/UMNlC(13): B->b() #1 {main} thrown in /in/UMNlC on line 6
Process exited with code 255.
Output for 7.1.0 - 7.1.33
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; B has a deprecated constructor in /in/UMNlC on line 5 Warning: Declaration of C::b($a) should be compatible with B::b(A $a) in /in/UMNlC on line 11 Fatal error: Uncaught ArgumentCountError: Too few arguments to function B::b(), 0 passed in /in/UMNlC on line 13 and exactly 1 expected in /in/UMNlC:6 Stack trace: #0 /in/UMNlC(13): B->b() #1 {main} thrown in /in/UMNlC on line 6
Process exited with code 255.
Output for 7.0.0 - 7.0.33
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; B has a deprecated constructor in /in/UMNlC on line 5 Warning: Declaration of C::b($a) should be compatible with B::b(A $a) in /in/UMNlC on line 11 Fatal error: Uncaught TypeError: Argument 1 passed to B::b() must be an instance of A, none given, called in /in/UMNlC on line 13 and defined in /in/UMNlC:6 Stack trace: #0 /in/UMNlC(13): B->b() #1 {main} thrown in /in/UMNlC on line 6
Process exited with code 255.
Output for 5.4.4 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Strict Standards: Declaration of C::b() should be compatible with B::b(A $a) in /in/UMNlC on line 11 Catchable fatal error: Argument 1 passed to B::b() must be an instance of A, none given, called in /in/UMNlC on line 13 and defined in /in/UMNlC on line 6
Process exited with code 255.
Output for 5.3.0 - 5.3.29
Strict Standards: Declaration of C::b() should be compatible with that of B::b() in /in/UMNlC on line 11 Catchable fatal error: Argument 1 passed to B::b() must be an instance of A, none given, called in /in/UMNlC on line 13 and defined in /in/UMNlC on line 6
Process exited with code 255.

preferences:
32.61 ms | 1196 KiB | 6 Q