3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $ary = array(1, 2, 3); foreach ($ary as &$v) {} $v2 = $v; $v2 = 4; var_dump($v); var_dump($v2); var_dump($ary); $ary2 = array(4, 5, 6); foreach ($ary2 as $v) { } var_dump($ary);
based on R5jav
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.2.6
int(3) int(4) array(3) { [0]=> int(1) [1]=> int(2) [2]=> &int(3) } array(3) { [0]=> int(1) [1]=> int(2) [2]=> &int(6) }