3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo{ public function __call($method, $args) { if(is_callable(array($this, $method))) { return call_user_func_array($this->$method, $args); } // else throw exception } } $foo = new Foo; $foo->cb = function($who) { return "Hello $who"; }; echo $foo->cb('World');

preferences:
27.4 ms | 402 KiB | 5 Q