3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = array(1, 2, 3); $values = &$a; foreach ($values as $value) { $values[3] = "bob"; if ($value == "bob") { $values[3] = "We made it into the if"; } } var_dump($values);
based on Fkk0s
Output for 7.0.0 - 7.2.0
array(4) { [0]=> int(1) [1]=> int(2) [2]=> int(3) [3]=> string(3) "bob" }
Output for 5.3.20 - 5.6.28
array(4) { [0]=> int(1) [1]=> int(2) [2]=> int(3) [3]=> string(22) "We made it into the if" }