3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public int $bar = 42; public function &getIterator() { foreach([1, &$this->bar] as &$item) { yield $item; } } } $foo = new Foo(); foreach($foo->getIterator() as &$item) { $a = &$item; } $a = "blah"; var_dump($foo);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught TypeError: Cannot assign string to reference held by property Foo::$bar of type int in /in/DQvKe:22 Stack trace: #0 {main} thrown in /in/DQvKe on line 22
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:
111.49 ms | 2156 KiB | 4 Q