i am new to php and i want to achieve the following. i have search on internet but i didnt find any help.
$user = new User();
$user->setFirstName('John')->setLastName('Doe')->setEmail('[email protected]');
echo $user;
and i want the output like the following
"John Doe <[email protected]>"
Following is what i am trying to do
class User {
// Properties
public $setFirstName;
public $setLastName;
public $setEmail;
// Methods
function setFirstName($setFirstName) {
$this->setFirstName = $setFirstName;
}
function setLastName($setLastName) {
$this->setLastName = $setLastName;
}
function setEmail($setEmail) {
$this->setEmail = $setEmail;
}
}