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; public function __construct($Username) { $Messages = array(); $Messages[] = "Message 1"; $Messages[] = "Message 2"; } } $theUser = User::Login("Poopy", "Butt"); echo $theUser->Username; echo $theUser->Password; echo $theUser->$Username; echo $theUser->$Password; print_r($theUser->Messages); ?>

preferences:
30.06 ms | 402 KiB | 5 Q