3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { protected $_b = 'protected'; private $_c = 'private'; public function __call($method, array $args) { var_dump($method, $args); } } $method = function (){ var_dump($this->_b, $this->_c);}; $a = new A; $a->newMethod = $method->bindTo($a, 'A'); $a->newMethod(); var_dump($a);

preferences:
36.44 ms | 402 KiB | 5 Q