3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $x = array(); $x["0"] = "foo"; $x["1"] = "bar"; foreach ($x as $k => $v) { var_dump($k); var_dump($v); } echo "-----------\r\n"; $x["3"] = "baz"; foreach ($x as $k => $v) { var_dump($k); var_dump($v); }
based on ppqUW
Output for 4.3.0 - 7.2.0
int(0) string(3) "foo" int(1) string(3) "bar" ----------- int(0) string(3) "foo" int(1) string(3) "bar" int(3) string(3) "baz"