3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $foo = [ 1 => ['a', 'b', 'c'], 2 => ['d', 'e', 'f'], 3 => ['g', 'h', 'i'] ]; foreach ($foo as $f) { var_dump(each($foo)); }
based on O35JU
Output for 7.2.0
Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /in/nYnb6 on line 10 array(4) { [1]=> array(3) { [0]=> string(1) "a" [1]=> string(1) "b" [2]=> string(1) "c" } ["value"]=> array(3) { [0]=> string(1) "a" [1]=> string(1) "b" [2]=> string(1) "c" } [0]=> int(1) ["key"]=> int(1) } array(4) { [1]=> array(3) { [0]=> string(1) "d" [1]=> string(1) "e" [2]=> string(1) "f" } ["value"]=> array(3) { [0]=> string(1) "d" [1]=> string(1) "e" [2]=> string(1) "f" } [0]=> int(2) ["key"]=> int(2) } array(4) { [1]=> array(3) { [0]=> string(1) "g" [1]=> string(1) "h" [2]=> string(1) "i" } ["value"]=> array(3) { [0]=> string(1) "g" [1]=> string(1) "h" [2]=> string(1) "i" } [0]=> int(3) ["key"]=> int(3) }
Output for 7.0.0 - 7.1.10
array(4) { [1]=> array(3) { [0]=> string(1) "a" [1]=> string(1) "b" [2]=> string(1) "c" } ["value"]=> array(3) { [0]=> string(1) "a" [1]=> string(1) "b" [2]=> string(1) "c" } [0]=> int(1) ["key"]=> int(1) } array(4) { [1]=> array(3) { [0]=> string(1) "d" [1]=> string(1) "e" [2]=> string(1) "f" } ["value"]=> array(3) { [0]=> string(1) "d" [1]=> string(1) "e" [2]=> string(1) "f" } [0]=> int(2) ["key"]=> int(2) } array(4) { [1]=> array(3) { [0]=> string(1) "g" [1]=> string(1) "h" [2]=> string(1) "i" } ["value"]=> array(3) { [0]=> string(1) "g" [1]=> string(1) "h" [2]=> string(1) "i" } [0]=> int(3) ["key"]=> int(3) }
Output for 5.4.1 - 5.6.28
array(4) { [1]=> array(3) { [0]=> string(1) "d" [1]=> string(1) "e" [2]=> string(1) "f" } ["value"]=> array(3) { [0]=> string(1) "d" [1]=> string(1) "e" [2]=> string(1) "f" } [0]=> int(2) ["key"]=> int(2) } array(4) { [1]=> array(3) { [0]=> string(1) "g" [1]=> string(1) "h" [2]=> string(1) "i" } ["value"]=> array(3) { [0]=> string(1) "g" [1]=> string(1) "h" [2]=> string(1) "i" } [0]=> int(3) ["key"]=> int(3) } bool(false)
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/nYnb6 on line 3
Process exited with code 255.