3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait Immutable { public function __set($name, $value) { throw new Exception('<iframe width="420" height="315" src="https://www.youtube.com/embed/otCpCn0l4Wo?t=14" frameborder="0" allowfullscreen></iframe>'); } public function __get($name) { return $this->$name; } } class ImmutableThingy { use Immutable; protected $foo = 'bar'; } $thing = new ImmutableThingy; var_dump($thing, $thing->foo); $thing->foo = 'baz'; var_dump($thing, $thing->foo);
Output for git.master, git.master_jit, rfc.property-hooks
object(ImmutableThingy)#1 (1) { ["foo":protected]=> string(3) "bar" } string(3) "bar" Fatal error: Uncaught Exception: <iframe width="420" height="315" src="https://www.youtube.com/embed/otCpCn0l4Wo?t=14" frameborder="0" allowfullscreen></iframe> in /in/cev6l:5 Stack trace: #0 /in/cev6l(23): ImmutableThingy->__set('foo', 'baz') #1 {main} thrown in /in/cev6l on line 5
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:
44.34 ms | 401 KiB | 8 Q