3v4l.org

run code in 300+ PHP versions simultaneously
<?php class a { public function f(&$ref1, &$ref2) { $ref1 = 'foo'; $ref2 = 'bar'; } } class b { public function __call($methodName, $arguments) { $a = new a(); call_user_func_array(array( $a, $methodName //->$methodName( $arguments[0][0], $arguments[0][1]); ), $arguments); } } $ref1 = 'X'; $ref2 = 'Y'; $b = new b(); $b->f( $ref1, $ref2); var_dump($ref1, $ref2);

preferences:
37.03 ms | 402 KiB | 5 Q