3v4l.org

run code in 300+ PHP versions simultaneously
<?php class IncrementIterator implements iterator { protected $start; protected $end; protected $current; public function __construct($start, $end) { $this->start = $start; $this->end = $end; } public function rewind() { $this->current = $this->start; } public function valid() { return $this->current <= $this->end; } public function key() { return $this->current; } public function current() { return $this->current; } public function next() { $this->current++; } } $aIterator = new IncrementIterator(0, 26); $bIterator = new IncrementIterator(0, 26); $cIterator = new IncrementIterator(0, 26); $dIterator = new IncrementIterator(0, 26); $multipleIterator = new MultipleIterator(); $multipleIterator->attachIterator($aIterator); $multipleIterator->attachIterator($bIterator); $multipleIterator->attachIterator($cIterator); $multipleIterator->attachIterator($dIterator); foreach ($multipleIterator as $current) { var_dump($current); }
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Return type of IncrementIterator::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/TFref on line 24 Deprecated: Return type of IncrementIterator::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/TFref on line 28 Deprecated: Return type of IncrementIterator::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/TFref on line 20 Deprecated: Return type of IncrementIterator::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/TFref on line 16 Deprecated: Return type of IncrementIterator::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/TFref on line 12 array(4) { [0]=> int(0) [1]=> int(0) [2]=> int(0) [3]=> int(0) } array(4) { [0]=> int(1) [1]=> int(1) [2]=> int(1) [3]=> int(1) } array(4) { [0]=> int(2) [1]=> int(2) [2]=> int(2) [3]=> int(2) } array(4) { [0]=> int(3) [1]=> int(3) [2]=> int(3) [3]=> int(3) } array(4) { [0]=> int(4) [1]=> int(4) [2]=> int(4) [3]=> int(4) } array(4) { [0]=> int(5) [1]=> int(5) [2]=> int(5) [3]=> int(5) } array(4) { [0]=> int(6) [1]=> int(6) [2]=> int(6) [3]=> int(6) } array(4) { [0]=> int(7) [1]=> int(7) [2]=> int(7) [3]=> int(7) } array(4) { [0]=> int(8) [1]=> int(8) [2]=> int(8) [3]=> int(8) } array(4) { [0]=> int(9) [1]=> int(9) [2]=> int(9) [3]=> int(9) } array(4) { [0]=> int(10) [1]=> int(10) [2]=> int(10) [3]=> int(10) } array(4) { [0]=> int(11) [1]=> int(11) [2]=> int(11) [3]=> int(11) } array(4) { [0]=> int(12) [1]=> int(12) [2]=> int(12) [3]=> int(12) } array(4) { [0]=> int(13) [1]=> int(13) [2]=> int(13) [3]=> int(13) } array(4) { [0]=> int(14) [1]=> int(14) [2]=> int(14) [3]=> int(14) } array(4) { [0]=> int(15) [1]=> int(15) [2]=> int(15) [3]=> int(15) } array(4) { [0]=> int(16) [1]=> int(16) [2]=> int(16) [3]=> int(16) } array(4) { [0]=> int(17) [1]=> int(17) [2]=> int(17) [3]=> int(17) } array(4) { [0]=> int(18) [1]=> int(18) [2]=> int(18) [3]=> int(18) } array(4) { [0]=> int(19) [1]=> int(19) [2]=> int(19) [3]=> int(19) } array(4) { [0]=> int(20) [1]=> int(20) [2]=> int(20) [3]=> int(20) } array(4) { [0]=> int(21) [1]=> int(21) [2]=> int(21) [3]=> int(21) } array(4) { [0]=> int(22) [1]=> int(22) [2]=> int(22) [3]=> int(22) } array(4) { [0]=> int(23) [1]=> int(23) [2]=> int(23) [3]=> int(23) } array(4) { [0]=> int(24) [1]=> int(24) [2]=> int(24) [3]=> int(24) } array(4) { [0]=> int(25) [1]=> int(25) [2]=> int(25) [3]=> int(25) } array(4) { [0]=> int(26) [1]=> int(26) [2]=> int(26) [3]=> int(26) }

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:
52.72 ms | 409 KiB | 8 Q