name = $name;
$this->title = $title;
}
public function __toString() {
return $this->getFormattedSalutation();
}
public function getFormattedSalutation() {
return $this->getSalutation();
}
private function getSalutation() {
return $this->title . " " . $this->name;
}
public function getName() {
return $this->name;
}
public function setName($name) {
$this->name = $name;
}
public function getTitle() {
return $this->title;
}
public function setTitle($title) {
$this->title = $title;
}
}
class Developer extends User {
public $skills = array();
public function getSkillsString() {
echo implode(", ",$this->skills);
}
}
$user = new User("Jane Smith","Ms");
echo $user;
echo "
";
$developer = new Developer("Jane Smith", "Ms");
echo $developer;
echo "
";
$developer->skills = array("JavasScript", "HTML", "CSS");
$developer->skills[] = "PHP";
$developer->getSkillsString();