3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $elements = [1,2,3,4,5]; foreach ($elements as $k => &$item) { //.... } $another = [1,2,3,4,5]; foreach ($another as $k => $item) { $item++; } var_dump($elements);
Output for 5.6.0 - 7.3.1
array(5) { [0]=> int(1) [1]=> int(2) [2]=> int(3) [3]=> int(4) [4]=> &int(6) }