3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = array(0 => 'a', 1 => 'b'); foreach ($a as $k => $v) { if ($k == 0) { $a['v'] = $v; } unset($a[$k]); } print_r($a);
Output for 4.3.0 - 7.1.0
Array ( [v] => a )