Created
October 16, 2018 08:16
-
-
Save muhamadsobari198/e56eaa632221eccc46bb64c93d7b6f8e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Person | |
{ | |
private $firstName; | |
private $lastName; | |
private $age; | |
public function __construct(string $firstName, string $lastName, int $age) | |
{ | |
$this->firstName = $firstName; | |
$this->lastName = $lastName; | |
$this->age = $age; | |
} | |
public function getFullName(): string | |
{ | |
return "{$this->firstName} {$this->lastName}"; | |
} | |
public function describe(): string | |
{ | |
return "Hello {$this->getFullName()}, this is your age: {$this->age}"; | |
} | |
} | |
$person = new Person('Jan Joshua', 'Esmer', 25); | |
echo $person->describe(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment