3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Bla implements Iterator { private $pos = 0; public function __construct() { $this->pos = 0; } function rewind() { $this->pos = 0; } function current() { return $this->pos; } function key() { return $this->pos; } function next() { $this->pos++; } function valid() { return pos < 3; } } echo "results:"; $bla = new Bla(); $i = 0; function arrara() { foreach($bla as $a) { foreach ($bla as $b) { echo "($a, $b)<br />"; $i++; if ($i > 20) return; } if ($i > 20) return; } } arrara();
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Return type of Bla::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/kHqGX on line 17 Deprecated: Return type of Bla::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/kHqGX on line 27 Deprecated: Return type of Bla::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/kHqGX on line 22 Deprecated: Return type of Bla::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/kHqGX on line 32 Deprecated: Return type of Bla::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/kHqGX on line 12 results: Warning: Undefined variable $bla in /in/kHqGX on line 46 Warning: foreach() argument must be of type array|object, null given in /in/kHqGX on line 46

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