Hi guys, I'm trying to use the OOP in PHP. I just don't know whats wrong with the following code:
class ContactLoader {
var $address;
var $email;
function ContactLoader() {
$this->$address = "";
$this->$email = "";
}
function loadContact() {
$this->$address = "Some address";
$this->$email = "Some email";
}
function getAddress() {
return $this->$address;
}
function getEmail() {
return $this->$email;
}
}
$contactLoader = new ContactLoader();
$contactLoader->loadContact();
print($contactLoader->getAddress());
The last line it printing the "Some email" text, it overwrites the address text somehow.
Any suggestion?