3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo implements Iterator { protected $count = 500; public function next() { $this->count--; } public function valid() { return $this->count > 0; } public function rewind() { $this->count = 500; } public function key() { return null; } public function current() { return $this->count; } } // This one $f = new Foo; foreach($f as $val) { } var_dump($f);
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Return type of Foo::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/fm5Io on line 21 Deprecated: Return type of Foo::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/fm5Io on line 5 Deprecated: Return type of Foo::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/fm5Io on line 17 Deprecated: Return type of Foo::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/fm5Io on line 9 Deprecated: Return type of Foo::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/fm5Io on line 13 object(Foo)#1 (1) { ["count":protected]=> 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:
40.33 ms | 403 KiB | 8 Q