3v4l.org

run code in 300+ PHP versions simultaneously
<?php class LazyProperties { protected $foo; public function __construct() { unset($this->foo); } public function getFoo() { return $this->foo; } public function __get($property) { switch ($property) { case 'foo': echo __METHOD__."() is called\n"; return $this->foo = 'magic'; } } } $o = new LazyProperties(); var_dump($o->getFoo()); var_dump($o->getFoo()); var_dump($o->getFoo());
Output for git.master, git.master_jit, rfc.property-hooks
LazyProperties::__get() is called string(5) "magic" string(5) "magic" string(5) "magic"

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:
29.64 ms | 405 KiB | 5 Q