3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { protected function y() { echo 'Foo called' . PHP_EOL; var_dump( func_get_args()); } } class Bar extends Foo { public function __call($name, $args) { echo 'Bar called' . PHP_EOL; /** This works, but arg[0] is the name of the method called and [1] is the args call_user_func_array( 'parent::' . $name, func_get_args() ); */ forward_static_call( ['parent', $name], func_get_args()[1] ); } } $bar = (new Bar)->y(4,2);

preferences:
41.9 ms | 402 KiB | 5 Q