Code: Select all
<?php
class User
{
// Local variables
var $username;
var $password;
var $keepLoggedIn;
// Constructor function
function User()
{
$this->username = "not_set";
$this->password = "not_set";
$this->keepLoggedIn = "not_set";
}
}
?>Code: Select all
$currentUser = new User;I then have code like this:
Code: Select all
$currentUser->password = "test";
echo $currentUser.password . "<br>";Object id #1password.
How come? Why not test? If I don't include the line with $currentUser->password = "test"; and just echo out the password I still get: Object id #1password. Why? Why not "not_set"? Also why does it display Object id #1?