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; foreach($bla as $a) { $i++; foreach ($bla as $b) { echo "($a, $b)<br />"; } if ($i > 5) break; }
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/EKp5H 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/EKp5H 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/EKp5H 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/EKp5H 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/EKp5H on line 12 results: Fatal error: Uncaught Error: Undefined constant "pos" in /in/EKp5H:34 Stack trace: #0 /in/EKp5H(44): Bla->valid() #1 {main} thrown in /in/EKp5H on line 34
Process exited with code 255.

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:
42.57 ms | 402 KiB | 8 Q