class SaeedPoureshghi{
public $birthdate = '1982/03/14';
private $nationality = 'Iranian';
public function Age() {
$now = date_create();
$birthday = date_create($this->birthdate);
$diff = date_diff($now,$birthday);
return $diff->format("%y YearsOld!");
}
public function getNationality() {
return $this->nationality;
}
}
$sp = new SaeedPoureshghi();
echo 'I am '.$sp->Age().' and an '.$sp->getNationality();
//output
I am 42 YearsOld! and an Iranian
$sp = new SaeedPoureshghi();
$result = 'I am '.$sp->Age();
$result .= ' and an '.$sp->getNationality();
echo $result;
//output
I am 42 YearsOld! and an Iranian
![saeed poureshghi](./assets/one2.png)
Hi, I am Saeed Poureshghi
I am a full stack developer!
All Rights Reserved 2024