3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ll = new SplDoublyLinkedList(); $ll->push('ze'); $ll->push('ome'); $ll->push('yei'); $ll->push('nahui'); $ll->rewind(); // HHVM works fine $iterations_done = iterator_apply($ll, function(Iterator $it) { echo implode("\t=>", array( $it->key(), $it->current(), ucfirst($it->current()) )),"\n"; return true; }, array($ll)); echo "Did iterate {$iterations_done} times \n"; $ll->rewind(); $iterations_done = iterator_apply($ll, function(Iterator $it) { echo implode("\t=>", array( $it->key(), $it->current(), ucfirst($it->current()) )),"\n"; $it->next(); return true; }, array($ll)); echo "Did iterate {$iterations_done} times \n"; $ll->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO | SplDoublyLinkedList::IT_MODE_DELETE); var_dump($ll->count()); foreach($ll as $key => $val) { echo "{$key}\t",ucfirst($val),"\n"; } var_dump($ll->count());
Output for git.master, git.master_jit, rfc.property-hooks
0 =>ze =>Ze 0 =>ze =>Ze 0 =>ze =>Ze 0 =>ze =>Ze Did iterate 4 times 0 =>ze =>Ze 1 =>ome =>Ome 2 =>yei =>Yei 3 =>nahui =>Nahui Did iterate 4 times int(4) 0 Ze 0 Ome 0 Yei 0 Nahui int(0)

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