This forum is now read-only. Please use our new forums! Go to forums
4/10 error
Answer 53c237139c4e9d8fcb00395e
Answer 53bc69c752f86353c30002cf
you are missing the “t” in $firstname
Answer 53c3407280ff3334f8000c7b
Same problem…
<!DOCTYPE html>
<html>
<head>
<title>Reconstructing the Person Class</title>
<link type='text/css' rel='stylesheet' href='style.css'/>
</head>
<body>
<p>
<?php
class Person {
public $isAlive = "true";
public $age;
public $firstname;
public $lastname;
}
$teacher = new Person();
$student = new Person();
echo $teacher->isAlive;
?>
</p>
</body>
</html>
1 comments
Fixed. No quotes around the true. http://www.codecademy.com/forum_questions/52df318d282ae3cc4f00166d
Thanks!!
Answer 53c4e6e6282ae3af26003dc1
1 comments
the “a” should be capitalized when you call isAlive, and you need to end the command with a semicolon.
Answer 53d2852a282ae3d576000165
This didn’t pass for me until I had an empty line after public $age
.
Answer 53bc4e1580ff33a3420001b3
Answer 53ca5c68631fe9775c000cac
just change the isalive to isAlive and the firstname and last name to firstName and lastName and if it says did you add the first name last name age ,change them back,and if it says did you add the is alive then just change it back it works really
Answer 53dfe48b8c1cccbe14000187
I was stuck on this question for at least 40 minutes. In the end, mine didn’t work until I added the line: // below the opening PHP tag.
So, the following did NOT work:
<?php
class Person {
public $isAlive = true;
...
but this did:
<?php
// <!-- Your code here -->
class Person {
public $isAlive = true;
...
Answer 53e022e59c4e9dbd03000ad0
This works. I had to comment out the <!– part with // and make sure that $firstname and $lastname were type not-camel case. As in, not $firstName (habit).
<!DOCTYPE html>
<html>
<head>
<title>Reconstructing the Person Class</title>
<link type='text/css' rel='stylesheet' href='style.css'/>
</head>
<body>
<p>
<?php
//<!-- Your code here -->
class Person {
public $isAlive = true;
public $firstname;
public $lastname;
public $age;
}
$teacher = new Person();
$student = new Person();
echo $teacher->isAlive;
?>
</p>
</body>
</html>
3 comments
thanks
nonsense
Yep. I had uppercase N’s. That one cost me my coding streak.
Answer 54bb2c9f95e378df2a002f16
class person { public $isAlive = true; public $firstname; public $lastname; public $age;
} $teacher = new person(); $student = new person(); echo $teacher -> 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
2 comments
I wrote my code like yours and it failed to pass until I changed the capitalization of my variables to $firstname, $lastname (without the capital ‘N’ in ‘Name’).
I had that too but it still didn’t work. Sometimes you might have to refresh the screen.