3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public function __construct($decorated) { $this->decorated = $decorated; } public function __call($method, $args) { $decorated = array_filter($args, function($arg) { return ($arg instanceof Decorated); })[0]; $response = call_user_func_array( array($this->service, $method), $args ); return $response; } } class Decorated { public function doSomething() { return 'did something'; } } $x = new Decorated; $t = new Test($x); $response = $t->doSomething(); echo $response;

preferences:
68.2 ms | 402 KiB | 5 Q