3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $array = array('a'=>'1','b'=>'2','c'=>'3'); foreach($array as $value) { $array['c'] = 'd'; var_dump($value); var_dump(current($array)); }
based on bZYVL
Output for 7.0.0 - 7.2.0
string(1) "1" string(1) "1" string(1) "2" string(1) "1" string(1) "3" string(1) "1"
Output for 5.3.19 - 5.6.28
string(1) "1" string(1) "2" string(1) "2" string(1) "2" string(1) "3" string(1) "2"