Денис Скрипниченко (программист)
class Skripnichenko
{
function __construct()
{
}
// ...
}
class Profession
{
const STUDENT = 'student';
// ...
}
class Language
{
const PHP = 'PHP';
const OBJECTIVE_C = 'Objective C';
// ...
}
class Denis extends Skripnichenko
{
private $age = 0;
private $hobbies = [];
private $programmingLanguages = [];
private $profession = null;
private $name = null;
function __construct()
{
parent::__construct();
$this->age = 20;
$this->name = 'Denis Skripnichenko';
$this->profession = Profession::STUDENT;
$this->programmingLanguages = [Language::PHP, Language::OBJECTIVE_C];
$this->hobbies = ['programming', 'reading', 'gym'];
}
public function aboutMe()
{
return sprintf(
'Hi! My name is %s, I’m %d years old and I am a %s. I like %s. My favorite programming languages are %s.',
$this->name,
$this->age,
$this->profession,
implode(', ', $this->hobbies),
implode(', ', $this->programmingLanguages)
);
}
}
$denis = new Denis();
echo $denis->aboutMe();
exit;