run code in 300+ PHP versions simultaneously
<?php // plain variable $a = 42; // array containing a reference $b = [ 'a' => &$a ]; // capture the array by-value $f = function() use($b) { // update the reference from inside the closure $b['a'] = 69; }; // call it $f(); // observe that both the array and the plain variable now have the new value var_dump($a, $b);
Output for git.master, git.master_jit
int(69) array(1) { ["a"]=> &int(69) }

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

32.52 ms | 408 KiB | 5 Q