3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Wrapper { public function foo (&...$args) { return $this->dostuff(...$args); } public function dostuff($param1, $param2, &$arr) { $arr[] = $param1; $arr[] = $param2; return count($arr); } } $values = [1,2]; $a=3; $b=4; $obj = new Wrapper(); #all parameter must be variables here because there are by ref now $count = $obj->foo($a,$b, $values); echo "Elements count: $count\r\n"; print_r($values); //Expected [1,2,3,4]
Output for git.master, git.master_jit, rfc.property-hooks
Elements count: 4 Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 )

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:
32.15 ms | 405 KiB | 5 Q