3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Config { //declare variables private $kmailtext; function __construct() { $this->kmailtext = "Mail ons"; } public function __get($name) { return $this->$name; } } class someOtherClass extends Config { private $kmailsubject; function __construct() { $this->$kmailsubject = "Subject"; parent::__construct(); } public function someOtherFunction() { return $this->kmailsubject; } public function __get($name) { if (isset($this->$name)) return $this->$name; return parent::__get($name); } } $config = new someOtherClass(); echo $config->someOtherFunction(), PHP_EOL; echo $config->someFunction();
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined variable $kmailsubject in /in/plNvZ on line 23 Deprecated: Creation of dynamic property someOtherClass::$ is deprecated in /in/plNvZ on line 23 Fatal error: Uncaught Error: Call to undefined method someOtherClass::someFunction() in /in/plNvZ:42 Stack trace: #0 {main} thrown in /in/plNvZ on line 42
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:
40.03 ms | 401 KiB | 8 Q