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 = null) { } } (new bar)->foo();
based on VbHau
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/9WFJL on line 3 Fatal error: Uncaught ArgumentCountError: Too few arguments to function foo::foo(), 0 passed in /in/9WFJL on line 16 and exactly 1 expected in /in/9WFJL:5 Stack trace: #0 /in/9WFJL(16): foo->foo() #1 {main} thrown in /in/9WFJL 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/9WFJL on line 3 Warning: Missing argument 1 for foo::foo(), called in /in/9WFJL on line 16 and defined in /in/9WFJL on line 5 Warning: Missing argument 1 for bar::foo(), called in /in/9WFJL on line 16 and defined in /in/9WFJL on line 12
Output for 5.4.11 - 5.6.28
Warning: Missing argument 1 for foo::foo(), called in /in/9WFJL on line 16 and defined in /in/9WFJL on line 5 Warning: Missing argument 1 for bar::foo(), called in /in/9WFJL on line 16 and defined in /in/9WFJL on line 12
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/9WFJL on line 16
Process exited with code 255.