3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MainClass{ public $var; function __construct(){ $this->var = "text"; } } class SecondClass{ public $var_2; function __construct(){ $this->var_2 = new MainClass(); } } class TheClass extends SecondClass{ public $var_3; function __construct(){ parent::__construct(); $this->var_3 = "Some Text..."; } } $foo = new SecondClass(); echo($foo->var_2->var); var_dump($foo); $doo = new TheClass(); echo($doo->var_2->var); var_dump($doo);
Output for git.master, git.master_jit, rfc.property-hooks
textobject(SecondClass)#1 (1) { ["var_2"]=> object(MainClass)#2 (1) { ["var"]=> string(4) "text" } } textobject(TheClass)#3 (2) { ["var_2"]=> object(MainClass)#4 (1) { ["var"]=> string(4) "text" } ["var_3"]=> string(12) "Some Text..." }

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.02 ms | 401 KiB | 8 Q