3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $i = 0; $data = [ 'a' => null, 'b' => null, 'c' => null, 'd' => null, 'e' => null ]; foreach ($data as &$item) { $item = ++$i; } var_dump($data); foreach ($data as $key => $item) { var_dump($item); }
based on hoEns
Output for 5.6.0 - 5.6.30, hhvm-3.18.5 - 3.22.0, 7.0.0 - 7.3.0rc3
array(5) { ["a"]=> int(1) ["b"]=> int(2) ["c"]=> int(3) ["d"]=> int(4) ["e"]=> &int(5) } int(1) int(2) int(3) int(4) int(4)