3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private $log; function __construct() { $this->log = function () { echo 'log'; }; } private function privateMethod() { echo 'calling private method'; } public function __call($method, $args) { if (is_callable(array($this, $method))) { return call_user_func_array($this->$method, $args); } } } $a = new A(); $a->log(); $a->privateMethod();

preferences:
55.33 ms | 402 KiB | 5 Q