3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Header { public function __construct() { $this->project = get_prior_object(); $this->modules = get_prior_object(1); } } class Modules { public function __construct() { $this->project = get_prior_object(); $this->header = new Header(); } } class Project { public $config = "config"; public function __construct() { $this->modules = new Modules(); } } $p = new Project(); var_dump($p->modules); function get_prior_object($skip = 0) { $bt = debug_backtrace(); foreach ($bt as $stack) { if (isset($stack['function']) && $stack['function'] === "__construct" && $skip-- <= 0) { return $stack['object']; } } return null; }
Output for git.master_jit, git.master, rfc.property-hooks
Deprecated: Creation of dynamic property Modules::$project is deprecated in /in/9s1gK on line 16 Deprecated: Creation of dynamic property Header::$project is deprecated in /in/9s1gK on line 7 Deprecated: Creation of dynamic property Header::$modules is deprecated in /in/9s1gK on line 8 Deprecated: Creation of dynamic property Modules::$header is deprecated in /in/9s1gK on line 17 Deprecated: Creation of dynamic property Project::$modules is deprecated in /in/9s1gK on line 27 object(Modules)#2 (2) { ["project"]=> *RECURSION* ["header"]=> object(Header)#3 (2) { ["project"]=> *RECURSION* ["modules"]=> *RECURSION* } }

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:
43.16 ms | 402 KiB | 8 Q