3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = [1,2,3]; $b = [4,5,6]; foreach ($a as &$v) { $v += 10; } var_dump($a[2]); foreach ($b as $v) { var_dump($a[2]); $v *= -1; } var_dump($a[2]); var_dump($a, $b);
based on 0EFpD
Output for 5.6.0 - 5.6.30, hhvm-3.18.5 - 3.22.0, 7.0.0 - 7.3.0beta1
int(13) int(4) int(5) int(6) int(-6) array(3) { [0]=> int(11) [1]=> int(12) [2]=> &int(-6) } array(3) { [0]=> int(4) [1]=> int(5) [2]=> int(6) }