3v4l.org

run code in 300+ PHP versions simultaneously
<?php $items = new ArrayObject(range(1,11)); echo 'there are ' . $items->count() . ' total items' . "\r\n"; $cachingIterator = new CachingIterator($items->getIterator()); $limitIterator = new LimitIterator($cachingIterator, 0, 10); $i = 0; foreach ($limitIterator as $item) { ++$i; } echo 'first page has ' . $i . ' items' . "\r\n"; if ($cachingIterator->hasNext()) { echo 'there is a next page'; } else { echo 'there is no next page'; }
Output for git.master, git.master_jit, rfc.property-hooks
there are 11 total items first page has 10 items there is no next page

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:
46.34 ms | 401 KiB | 8 Q