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(current($foo)); }
Output for 7.0.0 - 7.2.0
array(3) { [0]=> string(1) "a" [1]=> string(1) "b" [2]=> string(1) "c" } array(3) { [0]=> string(1) "a" [1]=> string(1) "b" [2]=> string(1) "c" } array(3) { [0]=> string(1) "a" [1]=> string(1) "b" [2]=> string(1) "c" }
Output for 5.4.1 - 5.6.28
array(3) { [0]=> string(1) "d" [1]=> string(1) "e" [2]=> string(1) "f" } array(3) { [0]=> string(1) "d" [1]=> string(1) "e" [2]=> string(1) "f" } array(3) { [0]=> string(1) "d" [1]=> string(1) "e" [2]=> string(1) "f" }
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/O35JU on line 3
Process exited with code 255.