3v4l.org

run code in 500+ PHP versions simultaneously
<?php $iterator = new ArrayIterator(range(1, 100)); function iterable_chunk(iterable $array, int $chunkSize) { for($i=0;;$i++) { $g = (function() use ($array, $chunkSize, $i) { $c = -1; $y = 0; foreach($array as $item) { $c ++; if ($c < $i*$chunkSize) { continue; } if ($c > ($i+1)*$chunkSize-1) { break; } $y ++; yield $item; } if ($y != $chunkSize) { throw new \Exception(); } })(); yield $g; } } try { foreach(iterable_chunk($iterator, 10) as $it1) { foreach ($it1 as $it) { echo $it . " "; } echo "\n"; } } catch (\Exception $e) {}
Output for rfc.property-hooks
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
63.63 ms | 2827 KiB | 4 Q