3v4l.org

run code in 200+ 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.2.0 - 7.3.0rc6
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.1.0 - 7.1.20
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.20
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.11.1, hhvm-3.13.2 - 3.17.3
Warning: b() expects exactly 1 parameter, 0 given in /in/UMNlC on line 6 Fatal error: Uncaught TypeError: Argument 1 passed to B::b() must be an instance of A, undefined variable given in /in/UMNlC:6 Stack trace: #0 /in/UMNlC(13): B->b() #1 {main}
Process exited with code 255.
Output for hhvm-3.12.14

Process exited with code 137.
Output for hhvm-3.10.1
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.30
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.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.