This forum is now read-only. Please use our new forums! Go to forums
4/10 passed but something is off with the code
Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION on line 11 //Code below
Answer 546ced7b52f86375fd004bc9
0 votes
To create your $teacher and $student Person objects you declare them outside of the Person class like so.
class Person { public $isAlive = true; public $firstname; public $lastname; public $age; }
$teacher = new Person(); $student = new Person();
echo $teacher->$isAlive;
I think that should be how 4/10 is solved, but for some reason it doesn’t recognize the properties after $isAlive.
Popular free courses
- Free Course
Learn SQL
In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.Beginner friendly,4 LessonsLanguage Fluency - Free Course
Learn JavaScript
Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.Beginner friendly,11 LessonsLanguage Fluency - Free Course
Learn HTML
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.Beginner friendly,6 LessonsLanguage Fluency
1 comments
There is no $ in the $teacher->isAlive