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);

preferences:
44.43 ms | 402 KiB | 5 Q