3v4l.org

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

preferences:
37.01 ms | 402 KiB | 5 Q