3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $tree = array ( array('id' => 1), array('id' => 2), array('id' => 3) ); foreach ($tree as &$node) { $node['read'] = $node['id']; } //unset( $node ); foreach ($tree as $key => $node) { $tree[$key]['write'] = $node['id']; } print_r($tree);
based on v2f2P
Output for 5.0.0 - 7.2.0
Array ( [0] => Array ( [id] => 1 [read] => 1 [write] => 1 ) [1] => Array ( [id] => 2 [read] => 2 [write] => 2 ) [2] => Array ( [id] => 2 [read] => 2 [write] => 2 ) )
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected '&', expecting T_VARIABLE or '$' in /in/tfkNb on line 9
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected '&', expecting T_VARIABLE or '$' in /in/tfkNb on line 9
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_VARIABLE' or `'$'' in /in/tfkNb on line 9
Process exited with code 255.