3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $x = array(0 => 1, 2 => 3, 4 => 5, 6 => 7, 8 => 9); foreach (array_keys($x) as $key => $value) { echo $key . "->". $value."\n"; } echo next($x)."\n"; echo next($x)."\n"; $y = $x; echo next($y)."\n"; echo next($y)."\n"; reset($y); echo next($x)."\n"; echo next($y)."\n";
based on bircj
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.15 - 7.0.20, 7.1.1 - 7.3.0alpha1
0->0 1->2 2->4 3->6 4->8 3 5 7 9 7 3
Output for 7.0.0 - 7.0.14, 7.1.0
0->0 1->2 2->4 3->6 4->8 3 5 3 5 7 3