3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ParentClass { public function foo($bar = "default") {} } class ChildClass extends ParentClass { public function foo($something) {} } $child = new ChildClass();
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.29, 8.2.0 - 8.2.20, 8.3.0 - 8.3.9
Fatal error: Declaration of ChildClass::foo($something) must be compatible with ParentClass::foo($bar = 'default') in /in/DI6ia on line 8
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Warning: Declaration of ChildClass::foo($something) should be compatible with ParentClass::foo($bar = 'default') in /in/DI6ia on line 8
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33
Warning: Declaration of ChildClass::foo($something) should be compatible with ParentClass::foo($bar = 'default') in /in/DI6ia on line 9
Output for 5.6.0 - 5.6.40
Strict Standards: Declaration of ChildClass::foo() should be compatible with ParentClass::foo($bar = 'default') in /in/DI6ia on line 9

preferences:
148.35 ms | 402 KiB | 297 Q