- print_r: documentation ( source)
<?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);
?>