3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php class A {} class B { public function b(A $a) {} } class C extends B { public function b($a) {} } $a = new C();
Output for 7.1.0
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.14
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 hhvm-3.10.0 - 3.12.0
Warning: b() expects exactly 1 parameter, 0 given in /in/UMNlC on line 6 Catchable fatal error: Argument 1 passed to B::b() must be an instance of A, undefined variable given in /in/UMNlC on line 6
Process exited with code 255.
Output for 5.4.4 - 5.6.21
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.4.0 - 5.4.3

Process exited with code 139.
Output for 5.2.10 - 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.