Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialTatenda Andrew Kwandara
18,322 PointsIn the Developer.php file, add a Developer class that is a child of the User class
Bummer: syntax error, unexpected 'class' (T_CLASS), expecting function (T_FUNCTION) in User.php on line 4 need help here i tried
<?php
//do not modify this file
class User {
class Developer extends User
{
protected $skills = array();
protected $name;
public function getSkills(){
return $this->skills;
}
public function setSkills($skill){
$this->skills = $skill;
}
public function displayUserSkills(){
$name = $this->name;
$userSkills = implode(', ', $this->skills);
return "$name has the following skills: $userSkills";
}
}
<?php
//add new child class here
class Developer extends User
{
protected $skills = array();
public function getSkills()
{
return $this->skills;
}
public function setSkills($skills)
{
$this->skills = $skills;
}
}
2 Answers
jamesjones21
9,260 PointsHi,
the user class has the Developer class mentioned in it, you will need to remove this, also there is a comment in the User class to not modify. So you will only need to modify the Developer.php file.
The User.php needs to remain as the following:
<?php
//do not modify this file
class User {
class Developer extends User
{
protected $skills = array();
protected $name;
public function getSkills(){
return $this->skills;
}
public function setSkills($skill){
$this->skills = $skill;
}
public function displayUserSkills(){
$name = $this->name;
$userSkills = implode(', ', $this->skills);
return "$name has the following skills: $userSkills";
}
}
Tatenda Andrew Kwandara
18,322 Pointsthanks it worked so well