3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $arr = array("one", "two", "three"); reset($arr); while (list($key, $value) = each($arr)) { echo "Key: $key; Value: $value<br />\n"; } foreach ($arr as $key => $value) { echo "Key: $key; Value: $value<br />\n"; switch($key) { case "one": echo $key; } } ?>
Output for 7.2.0 - 7.3.0alpha1
Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /in/AUYuQ on line 4 Key: 0; Value: one<br /> Key: 1; Value: two<br /> Key: 2; Value: three<br /> Key: 0; Value: one<br /> 0Key: 1; Value: two<br /> Key: 2; Value: three<br />
Output for 4.3.0 - 7.1.10
Key: 0; Value: one<br /> Key: 1; Value: two<br /> Key: 2; Value: three<br /> Key: 0; Value: one<br /> 0Key: 1; Value: two<br /> Key: 2; Value: three<br />