3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait StaticCall { protected function callStatic($className, $methodName) { $parameters = func_get_args(); $parameters = array_slice($parameters, 2); return call_user_func_array($className . '::' . $methodName, $parameters); } } class Base { public function foo() { echo __METHOD__; } } class First extends Base { use StaticCall; public function foo() { #$this->callStatic('parent', 'foo'); call_user_func_array('parent::foo', array()); } } class Second extends First { use StaticCall; } $s = new Second(); $s->foo();

preferences:
49.97 ms | 402 KiB | 5 Q