3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Bar implements Iterator { protected $offset = 0; function key(){ throw new Exception("collection doesn't have a key"); } function rewind(){ $this->offset = 0; } function next(){ $this->offset++; } function current(){ return "thank u baby jesus"; } function valid(){ return $this->offset <= 5; } } foreach(new Bar as $value){ var_dump($value); }
Output for rfc.property-hooks, git.master, git.master_jit
Deprecated: Return type of Bar::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/hGcqg on line 19 Deprecated: Return type of Bar::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/hGcqg on line 15 Deprecated: Return type of Bar::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/hGcqg on line 7 Deprecated: Return type of Bar::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/hGcqg on line 23 Deprecated: Return type of Bar::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/hGcqg on line 11 string(18) "thank u baby jesus" string(18) "thank u baby jesus" string(18) "thank u baby jesus" string(18) "thank u baby jesus" string(18) "thank u baby jesus" string(18) "thank u baby jesus"

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:
57.99 ms | 2846 KiB | 4 Q