3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php echo "<pre>"; $array = array_fill(0, 10, range("A", "Z")); function getTests($array) { $it = new ArrayIterator($array); $tests = array(); foreach ( $it as $range ) { foreach ( array_chunk($range, 2) as $chunk ) { yield $chunk; } } } foreach(getTests($array) as $value) { print_r($value); } ?>
Output for 5.5.0 - 7.1.0
<pre>Array ( [0] => A [1] => B ) Array ( [0] => C [1] => D ) Array ( [0] => E [1] => F ) Array ( [0] => G [1] => H ) Array ( [0] => I [1] => J ) Array ( [0] => K [1] => L ) Array ( [0] => M [1] => N ) Array ( [0] => O [1] => P ) Array ( [0] => Q [1] => R ) Array ( [0] => S [1] => T ) Array ( [0] => U [1] => V ) Array ( [0] => W [1] => X ) Array ( [0] => Y [1] => Z ) Array ( [0] => A [1] => B ) Array ( [0] => C [1] => D ) Array ( [0] => E [1] => F ) Array ( [0] => G [1] => H ) Array ( [0] => I [1] => J ) Array ( [0] => K [1] => L ) Array ( [0] => M [1] => N ) Array ( [0] => O [1] => P ) Array ( [0] => Q [1] => R ) Array ( [0] => S [1] => T ) Array ( [0] => U [1] => V ) Array ( [0] => W [1] => X ) Array ( [0] => Y [1] => Z ) Array ( [0] => A [1] => B ) Array ( [0] => C [1] => D ) Array ( [0] => E [1] => F ) Array ( [0] => G [1] => H ) Array ( [0] => I [1] => J ) Array ( [0] => K [1] => L ) Array ( [0] => M [1] => N ) Array ( [0] => O [1] => P ) Array ( [0] => Q [1] => R ) Array ( [0] => S [1] => T ) Array ( [0] => U [1] => V ) Array ( [0] => W [1] => X ) Array ( [0] => Y [1] => Z ) Array ( [0] => A [1] => B ) Array ( [0] => C [1] => D ) Array ( [0] => E [1] => F ) Array ( [0] => G [1] => H ) Array ( [0] => I [1] => J ) Array ( [0] => K [1] => L ) Array ( [0] => M [1] => N ) Array ( [0] => O [1] => P ) Array ( [0] => Q [1] => R ) Array ( [0] => S [1] => T ) Array ( [0] => U [1] => V ) Array ( [0] => W [1] => X ) Array ( [0] => Y [1] => Z ) Array ( [0] => A [1] => B ) Array ( [0] => C [1] => D ) Array ( [0] => E [1] => F ) Array ( [0] => G [1] => H ) Array ( [0] => I [1] => J ) Array ( [0] => K [1] => L ) Array ( [0] => M [1] => N ) Array ( [0] => O [1] => P ) Array ( [0] => Q [1] => R ) Array ( [0] => S [1] => T ) Array ( [0] => U [1] => V ) Array ( [0] => W [1] => X ) Array ( [0] => Y [1] => Z ) Array ( [0] => A [1] => B ) Array ( [0] => C [1] => D ) Array ( [0] => E [1] => F ) Array ( [0] => G [1] => H ) Array ( [0] => I [1] => J ) Array ( [0] => K [1] => L ) Array ( [0] => M [1] => N ) Array ( [0] => O [1] => P ) Array ( [0] => Q [1] => R ) Array ( [0] => S [1] => T ) Array ( [0] => U [1] => V ) Array ( [0] => W [1] => X ) Array ( [0] => Y [1] => Z ) Array ( [0] => A [1] => B ) Array ( [0] => C [1] => D ) Array ( [0] => E [1] => F ) Array ( [0] => G [1] => H ) Array ( [0] => I [1] => J ) Array ( [0] => K [1] => L ) Array ( [0] => M [1] => N ) Array ( [0] => O [1] => P ) Array ( [0] => Q [1] => R ) Array ( [0] => S [1] => T ) Array ( [0] => U [1] => V ) Array ( [0] => W [1] => X ) Array ( [0] => Y [1] => Z ) Array ( [0] => A [1] => B ) Array ( [0] => C [1] => D ) Array ( [0] => E [1] => F ) Array ( [0] => G [1] => H ) Array ( [0] => I [1] => J ) Array ( [0] => K [1] => L ) Array ( [0] => M [1] => N ) Array ( [0] => O [1] => P ) Array ( [0] => Q [1] => R ) Array ( [0] => S [1] => T ) Array ( [0] => U [1] => V ) Array ( [0] => W [1] => X ) Array ( [0] => Y [1] => Z ) Array ( [0] => A [1] => B ) Array ( [0] => C [1] => D ) Array ( [0] => E [1] => F ) Array ( [0] => G [1] => H ) Array ( [0] => I [1] => J ) Array ( [0] => K [1] => L ) Array ( [0] => M [1] => N ) Array ( [0] => O [1] => P ) Array ( [0] => Q [1] => R ) Array ( [0] => S [1] => T ) Array ( [0] => U [1] => V ) Array ( [0] => W [1] => X ) Array ( [0] => Y [1] => Z ) Array ( [0] => A [1] => B ) Array ( [0] => C [1] => D ) Array ( [0] => E [1] => F ) Array ( [0] => G [1] => H ) Array ( [0] => I [1] => J ) Array ( [0] => K [1] => L ) Array ( [0] => M [1] => N ) Array ( [0] => O [1] => P ) Array ( [0] => Q [1] => R ) Array ( [0] => S [1] => T ) Array ( [0] => U [1] => V ) Array ( [0] => W [1] => X ) Array ( [0] => Y [1] => Z )
Output for 5.4.0 - 5.4.45
Parse error: syntax error, unexpected '$chunk' (T_VARIABLE) in /in/nhCja on line 12
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected T_VARIABLE in /in/nhCja on line 12
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 T_VARIABLE in /in/nhCja on line 12
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/nhCja on line 12
Process exited with code 255.