3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class foo { public function foo($a) { } } class bar extends foo { public function foo($a, $b) { } } (new bar)->foo();
Output for 7.1.0 - 7.2.0
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; foo has a deprecated constructor in /in/VbHau on line 3 Warning: Declaration of bar::foo($a, $b) should be compatible with foo::foo($a) in /in/VbHau on line 14 Fatal error: Uncaught ArgumentCountError: Too few arguments to function foo::foo(), 0 passed in /in/VbHau on line 16 and exactly 1 expected in /in/VbHau:5 Stack trace: #0 /in/VbHau(16): foo->foo() #1 {main} thrown in /in/VbHau on line 5
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; foo has a deprecated constructor in /in/VbHau on line 3 Warning: Declaration of bar::foo($a, $b) should be compatible with foo::foo($a) in /in/VbHau on line 14 Warning: Missing argument 1 for foo::foo(), called in /in/VbHau on line 16 and defined in /in/VbHau on line 5 Warning: Missing argument 1 for bar::foo(), called in /in/VbHau on line 16 and defined in /in/VbHau on line 12 Warning: Missing argument 2 for bar::foo(), called in /in/VbHau on line 16 and defined in /in/VbHau on line 12
Output for 5.4.11 - 5.6.28
Strict Standards: Declaration of bar::foo() should be compatible with foo::foo($a) in /in/VbHau on line 14 Warning: Missing argument 1 for foo::foo(), called in /in/VbHau on line 16 and defined in /in/VbHau on line 5 Warning: Missing argument 1 for bar::foo(), called in /in/VbHau on line 16 and defined in /in/VbHau on line 12 Warning: Missing argument 2 for bar::foo(), called in /in/VbHau on line 16 and defined in /in/VbHau on line 12
Output for 5.3.21 - 5.3.29
Strict Standards: Declaration of bar::foo() should be compatible with that of foo::foo() in /in/VbHau on line 14 Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/VbHau on line 16
Process exited with code 255.