3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Testme { public static function foo(&$ref) { $ref = 1; } } class Invoker { public static function invoke($func_name) { $args = func_get_args_byref(); $ref = &array_slice($args,1); call_user_func_array(array('Testme', $func_name), $ref); } } function func_get_args_byref() { $trace = debug_backtrace(); return $trace[1]['args']; } $test = 2; $testRef = &$test; Invoker::invoke('foo', $testRef); var_dump($test);
Output for git.master, git.master_jit, rfc.property-hooks
Notice: Only variables should be assigned by reference in /in/N2Jd7 on line 11 Warning: Testme::foo(): Argument #1 ($ref) must be passed by reference, value given in /in/N2Jd7 on line 12 int(2)

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
46.76 ms | 401 KiB | 8 Q