3v4l.org

run code in 300+ PHP versions simultaneously
<?php class User { public $Username; public $Password; public $Inbox; private function __construct($Username, $Password) { $this->Username = $Username; $this->Password = $Password; $this->Inbox = new Inbox($Username); } public static function Login($Username, $Password) { return new User($Username, $Password); } } class Inbox { public $Messages = array(); public function __construct($Username) { $this->Messages = array(); $this->Messages[] = "Message 1"; $this->Messages[] = "Message 2"; } } $Username = "Username"; $Password = "Password"; $theUser = User::Login("Poopy", "Butt"); echo $theUser->Username; echo $theUser->Password; echo $theUser->$Username; echo $theUser->$Password; print_r($theUser->Inbox->Messages); var_dump(get_object_vars($theUser)); ?>
Output for git.master, git.master_jit, rfc.property-hooks
PoopyButtPoopyButtArray ( [0] => Message 1 [1] => Message 2 ) array(3) { ["Username"]=> string(5) "Poopy" ["Password"]=> string(4) "Butt" ["Inbox"]=> object(Inbox)#2 (1) { ["Messages"]=> array(2) { [0]=> string(9) "Message 1" [1]=> string(9) "Message 2" } } }

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