3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Because lol: https://github.com/alvaropinot/circular-iterator function circularIterator(Iterator $t) { while (true) { yield $t->current(); $t->next(); if (!$t->valid()) { $t->rewind(); } } } $iter = circularIterator( SplFixedArray::fromArray([1, 2, 3]) ); $iter->rewind(); var_dump($iter->current()); $iter->next(); var_dump($iter->current()); $iter->next(); var_dump($iter->current()); $iter->next(); var_dump($iter->current()); $iter->next();
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught TypeError: circularIterator(): Argument #1 ($t) must be of type Iterator, SplFixedArray given, called in /in/5cg8t on line 17 and defined in /in/5cg8t:5 Stack trace: #0 /in/5cg8t(17): circularIterator(Object(SplFixedArray)) #1 {main} thrown in /in/5cg8t on line 5
Process exited with code 255.

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