3v4l.org

run code in 300+ PHP versions simultaneously
<?php function &random_value(&$array, $default=null) { $k = 0; // mt_rand(0, count($array) - 1); if (isset($array[$k])) { return $array[$k]; } else { return $default; } } $companies = array(); $companies[] = array("name" => "Acme Co", "employees"=> array( "John", "Jane" )); $companies[] = array("name" => "Inotech", "employees"=> array( "Bill", "Michael" )); $x = &random_value($companies); $x["employees"][] = "Donald"; var_dump($x, $companies);
Output for git.master, git.master_jit, rfc.property-hooks
array(2) { ["name"]=> string(7) "Acme Co" ["employees"]=> array(3) { [0]=> string(4) "John" [1]=> string(4) "Jane" [2]=> string(6) "Donald" } } array(2) { [0]=> &array(2) { ["name"]=> string(7) "Acme Co" ["employees"]=> array(3) { [0]=> string(4) "John" [1]=> string(4) "Jane" [2]=> string(6) "Donald" } } [1]=> array(2) { ["name"]=> string(7) "Inotech" ["employees"]=> array(2) { [0]=> string(4) "Bill" [1]=> string(7) "Michael" } } }

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:
20.82 ms | 403 KiB | 8 Q