3v4l.org

run code in 300+ PHP versions simultaneously
<?php class FooBar implements Iterator { function __construct() { echo "Constructing new FooBar\n"; } function __destruct() { echo "Destructing FooBar\n"; } function current () { throw new Exception; } function key () { return 0; } function next () {} function rewind () {} function valid () { return true; } } function foo() { $f = new FooBar; yield from $f; yield 3; } function bar() { echo "Starting bar()\n"; $x = foo(); try { var_dump($x->current()); } catch (Exception $e) { echo "Caught Exception\n"; } var_dump($x->current()); echo "Unsetting \$x\n"; unset($x); echo "Finishing bar()\n"; } bar();
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Return type of FooBar::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/57VCW on line 6 Deprecated: Return type of FooBar::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/57VCW on line 8 Deprecated: Return type of FooBar::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/57VCW on line 7 Deprecated: Return type of FooBar::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/57VCW on line 10 Deprecated: Return type of FooBar::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /in/57VCW on line 9 Starting bar() Constructing new FooBar Destructing FooBar Caught Exception NULL Unsetting $x Finishing bar()

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