3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyClass { public function myMethod($foo, ...$args) { print $foo; print_r($args); } } $myClass = new MyClass(); $myClass->myMethod("Hi", "here", "are","some", "args"); class ChildClass extends MyClass { public function myMethod($foo) { print $foo; } }
Output for 8.0.1 - 8.0.26, 8.1.0 - 8.1.13, 8.2.0
Fatal error: Declaration of ChildClass::myMethod($foo) must be compatible with MyClass::myMethod($foo, ...$args) in /in/rEU6t on line 14
Process exited with code 255.

preferences:
163.58 ms | 1457 KiB | 7 Q