3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * @author tuadmin * @version 1.0.0 */ class combinator implements SeekableIterator { private $_n = 0;//float val public function next(){$this->_n++;} public function rewind(){$this->_n = 0;} public function current(){ return $this->_n;} public function key(){} public function valid(){return $this->_n < 10000000000000000000;} public function seek($pos){$this->_n = $pos;} } $comb = new combinator();$float = 10000000000; echo "-------------incorrect limit Iterator float seek----------\n"; foreach(new limitIterator($comb,$float,3) as $current){ echo $current."\n";} echo "-------------correct----------\n"; for($comb->seek($float) ; $comb->current() < $float+3 && $comb->valid();$comb->next()){ echo $comb->current()."\n";}
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Return type of combinator::seek($pos) should either be compatible with SeekableIterator::seek(int $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/mCQBW on line 14 Deprecated: Return type of combinator::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/mCQBW on line 11 Deprecated: Return type of combinator::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/mCQBW on line 9 Deprecated: Return type of combinator::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/mCQBW on line 12 Deprecated: Return type of combinator::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/mCQBW on line 13 Deprecated: Return type of combinator::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/mCQBW on line 10 -------------incorrect limit Iterator float seek---------- 10000000000 10000000001 10000000002 -------------correct---------- 10000000000 10000000001 10000000002

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:
62.07 ms | 404 KiB | 8 Q