3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $array = [0]; foreach ($array as &$val) { var_dump($val); $array[1] = 1; } $a = array('a' => 1, 'b' => 2); foreach($a as &$p) { $p += 1; } print_r($a);
based on jAhgf
Output for 7.0.0 - 7.2.0
int(0) int(1) Array ( [a] => 2 [b] => 3 )
Output for 5.5.0 - 5.6.28
int(0) Array ( [a] => 2 [b] => 3 )