This forum is now read-only. Please use our new forums at discuss.codecademy.com.

Objects in PHP Forum

View Course » View Exercise

86 points
3f8a36277f7182c51919f349bd7ade16?s=140&d=retro
Submitted by
thanosarta13
about 2 years ago

Troubled

<!DOCTYPE html>


Reconstructing the Person Class




<!-- Your code here -->
<?php
class Person {
public $isAlive = true;

public $firstname;
public $lastname;
public $age;
public function _construct($firstname, $lastname, $age) {
$this->firstname = $firstname;
$this->lastname = $lastname;
$this->age = $age;
}
}
$teacher = new Person ("boring" ,"12345" ,12345);
$student = new Person ("Thanos" , "Varis" , 22);
echo $student->age;
?>



What's wrong?


0 votes

permalink

Add one more underscore symbol _ before your construct function.

686 points
9a60e17395e12f0b1698491eb02d15fa?s=140&d=retro
Submitted by
assenov
about 2 years ago