3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $foo = new ArrayObject([1, 2, 3, 4, 5, 6, 7, 8, 'foo' => 'bar']); foreach ($foo as $bar) { foreach ($foo as $baz) { var_dump('Bar - ' . $bar . ', Baz - ' . $baz); } }
Output for 5.4.0 - 7.1.0
string(16) "Bar - 1, Baz - 1" string(16) "Bar - 1, Baz - 2" string(16) "Bar - 1, Baz - 3" string(16) "Bar - 1, Baz - 4" string(16) "Bar - 1, Baz - 5" string(16) "Bar - 1, Baz - 6" string(16) "Bar - 1, Baz - 7" string(16) "Bar - 1, Baz - 8" string(18) "Bar - 1, Baz - bar" string(16) "Bar - 2, Baz - 1" string(16) "Bar - 2, Baz - 2" string(16) "Bar - 2, Baz - 3" string(16) "Bar - 2, Baz - 4" string(16) "Bar - 2, Baz - 5" string(16) "Bar - 2, Baz - 6" string(16) "Bar - 2, Baz - 7" string(16) "Bar - 2, Baz - 8" string(18) "Bar - 2, Baz - bar" string(16) "Bar - 3, Baz - 1" string(16) "Bar - 3, Baz - 2" string(16) "Bar - 3, Baz - 3" string(16) "Bar - 3, Baz - 4" string(16) "Bar - 3, Baz - 5" string(16) "Bar - 3, Baz - 6" string(16) "Bar - 3, Baz - 7" string(16) "Bar - 3, Baz - 8" string(18) "Bar - 3, Baz - bar" string(16) "Bar - 4, Baz - 1" string(16) "Bar - 4, Baz - 2" string(16) "Bar - 4, Baz - 3" string(16) "Bar - 4, Baz - 4" string(16) "Bar - 4, Baz - 5" string(16) "Bar - 4, Baz - 6" string(16) "Bar - 4, Baz - 7" string(16) "Bar - 4, Baz - 8" string(18) "Bar - 4, Baz - bar" string(16) "Bar - 5, Baz - 1" string(16) "Bar - 5, Baz - 2" string(16) "Bar - 5, Baz - 3" string(16) "Bar - 5, Baz - 4" string(16) "Bar - 5, Baz - 5" string(16) "Bar - 5, Baz - 6" string(16) "Bar - 5, Baz - 7" string(16) "Bar - 5, Baz - 8" string(18) "Bar - 5, Baz - bar" string(16) "Bar - 6, Baz - 1" string(16) "Bar - 6, Baz - 2" string(16) "Bar - 6, Baz - 3" string(16) "Bar - 6, Baz - 4" string(16) "Bar - 6, Baz - 5" string(16) "Bar - 6, Baz - 6" string(16) "Bar - 6, Baz - 7" string(16) "Bar - 6, Baz - 8" string(18) "Bar - 6, Baz - bar" string(16) "Bar - 7, Baz - 1" string(16) "Bar - 7, Baz - 2" string(16) "Bar - 7, Baz - 3" string(16) "Bar - 7, Baz - 4" string(16) "Bar - 7, Baz - 5" string(16) "Bar - 7, Baz - 6" string(16) "Bar - 7, Baz - 7" string(16) "Bar - 7, Baz - 8" string(18) "Bar - 7, Baz - bar" string(16) "Bar - 8, Baz - 1" string(16) "Bar - 8, Baz - 2" string(16) "Bar - 8, Baz - 3" string(16) "Bar - 8, Baz - 4" string(16) "Bar - 8, Baz - 5" string(16) "Bar - 8, Baz - 6" string(16) "Bar - 8, Baz - 7" string(16) "Bar - 8, Baz - 8" string(18) "Bar - 8, Baz - bar" string(18) "Bar - bar, Baz - 1" string(18) "Bar - bar, Baz - 2" string(18) "Bar - bar, Baz - 3" string(18) "Bar - bar, Baz - 4" string(18) "Bar - bar, Baz - 5" string(18) "Bar - bar, Baz - 6" string(18) "Bar - bar, Baz - 7" string(18) "Bar - bar, Baz - 8" string(20) "Bar - bar, Baz - bar"
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[', expecting ')' in /in/Xp8EP on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[', expecting ')' in /in/Xp8EP on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `')'' in /in/Xp8EP on line 3
Process exited with code 255.