3v4l.org

run code in 300+ PHP versions simultaneously
<?php class B { public function __get($name) { $this->__set($name, new C); return $this->$name; } public function __set($name, $value) { $this->$name = $value; } } class C { public function test() { return new D; } } class D { public $d; } $b = new B; $b->c->test()->d = 'waa'; echo 'first call success' . PHP_EOL; $b->c->test(); echo 'just a call to test() works' . PHP_EOL; $b->c->test()->d = 'waa'; echo 'second call success' . PHP_EOL;
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Creation of dynamic property B::$c is deprecated in /in/bMKbI on line 13 first call success just a call to test() works second call success

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:
40.93 ms | 401 KiB | 8 Q