3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $dataset = array(0 => "one", 1 => "two"); reset($dataset); while ($v = current($dataset)) { var_dump($v); next($dataset); if ($v == "one") { unset($dataset[1]); } } var_dump($dataset); $dataset = array(0 => "one", 1 => "two"); reset($dataset); foreach ($dataset as $k => $v) { var_dump($v); next($dataset); if ($v == "one") { unset($dataset[1]); } } var_dump($dataset);
Output for 4.3.0 - 7.1.0
string(3) "one" array(1) { [0]=> string(3) "one" } string(3) "one" string(3) "two" array(1) { [0]=> string(3) "one" }