3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { public function foo($a) { } } class bar extends foo { public function foo($a, $b) { } } (new bar)->foo();
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Declaration of bar::foo($a, $b) must be compatible with foo::foo($a) in /in/VbHau on line 12
Process exited with code 255.
Output for 7.4.0 - 7.4.33
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 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.3.32 - 7.3.33
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.1.0 - 7.1.33, 7.2.0 - 7.2.33, 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; 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.5.24 - 5.5.35, 5.6.8 - 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

preferences:
184.74 ms | 403 KiB | 229 Q