3v4l.org

run code in 300+ PHP versions simultaneously
<?php class It implements Iterator { private $arr = [1,2,3]; public function key() { echo __METHOD__ . "\n"; return key($this->arr); } public function current() { echo __METHOD__ . "\n"; return current($this->arr); } public function rewind() { echo __METHOD__ . "\n"; reset($this->arr); } public function next() { echo __METHOD__ . "\n"; next($this->arr); } public function valid() { echo __METHOD__ . "\n"; return key($this->arr) === null; } } $it = new It; foreach ($it as $k => $v) {}
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Return type of It::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/dOr1H on line 13 Deprecated: Return type of It::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/dOr1H on line 25 Deprecated: Return type of It::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/dOr1H on line 7 Deprecated: Return type of It::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/dOr1H on line 31 Deprecated: Return type of It::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/dOr1H on line 19 It::rewind It::valid

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:
45.02 ms | 403 KiB | 8 Q