3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class parentCl { protected function parentMethod($arg) { echo "parent call $arg", PHP_EOL; } } class childCl extends parentCl { public function __construct() { echo "construct", PHP_EOL; } protected function childMethod($params) { echo "child call", PHP_EOL; } protected function childMethod2($params) { echo "child call2", PHP_EOL; } public function __call($name, $args) { call_user_func([$this, $name], ...$args); call_user_func([$this, 'parentMethod'], ...$args); } } //like this case, $n = new childCl(); $n->childMethod(123); $n->childMethod2(1234);

preferences:
161.91 ms | 404 KiB | 5 Q