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($a); next($dataset); if ($v == "one") { unset($dataset[1]); } } var_dump($dataset);
Output for 5.0.4 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
string(3) "one" array(1) { [0]=> string(3) "one" } Notice: Undefined variable: a in /in/sBO1V on line 19 NULL Notice: Undefined variable: a in /in/sBO1V on line 19 NULL array(1) { [0]=> string(3) "one" }
Output for hhvm-3.10.0

Process exited with code 153.
Output for 4.3.0 - 5.0.3
string(3) "one" array(1) { [0]=> string(3) "one" } Notice: Undefined variable: a in /in/sBO1V on line 19 NULL Notice: Undefined variable: a in /in/sBO1V on line 19 NULL array(1) { [0]=> string(3) "one" }