3v4l.org

run code in 300+ PHP versions simultaneously
<?php class C { public \stdClass $x; public function __construct() { $this->x = new \stdClass(); } public function foo() { print "->foo()\n"; var_export($this->x); } } class D extends C { public function __get($name) { print "\n"; print "__get($name)\n"; var_export($this->$name); } } $c = new D(); // $c->x = NULL; print "\$c->x\n"; var_export($c->x); print "\n\n-----------------\n"; print "\$c->x after unset()\n"; unset($c->x); var_export($c->x); print "\n\n-----------------\n"; $c->foo();
Output for git.master, git.master_jit, rfc.property-hooks
$c->x (object) array( ) ----------------- $c->x after unset() __get(x) Fatal error: Uncaught Error: Typed property C::$x must not be accessed before initialization in /in/sY96q:21 Stack trace: #0 /in/sY96q(34): D->__get('x') #1 {main} thrown in /in/sY96q on line 21
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:
79.35 ms | 401 KiB | 8 Q