3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $i = 0; $arr = array(); while ($i < 10) { $arr[] = $i; $arr["$i key"] = "$i value"; $i++; } foreach ($arr as $k => $v) { var_dump($k, $v); }
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
int(0) int(0) string(5) "0 key" string(7) "0 value" int(1) int(1) string(5) "1 key" string(7) "1 value" int(2) int(2) string(5) "2 key" string(7) "2 value" int(3) int(3) string(5) "3 key" string(7) "3 value" int(4) int(4) string(5) "4 key" string(7) "4 value" int(5) int(5) string(5) "5 key" string(7) "5 value" int(6) int(6) string(5) "6 key" string(7) "6 value" int(7) int(7) string(5) "7 key" string(7) "7 value" int(8) int(8) string(5) "8 key" string(7) "8 value" int(9) int(9) string(5) "9 key" string(7) "9 value"