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

Objects in PHP Forum

View Course » View Exercise

554 points
Submitted by
Joseph Kwami Azalekor
almost 3 years ago

Please I need a SOLUTION to my error(s).............

<!DOCTYPE html>

Reconstructing the Person Class

class Person {
$teacher = new Person();
$student = new 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("Joseph", "Azalekor", 20);
        echo $student->age;
        echo $student->isAlive;

1 vote


Here you are:

you should have this:

echo $teacher->isAlive; 
echo $student->age;

instead of this:

    echo $student->age;
    echo $student->isAlive;

Every thing else is good.

2283 points
Submitted by
Sergeant Shift
over 2 years ago


553ffdcd9113cba9ef0000e8_445393942 Joseph Kwami Azalekor over 2 years ago

thanks so much;
little mistakes.....................

A86f7a545bb298e9d17b1b0ba5ae2a31?s=140&d=retro Sergeant Shift over 2 years ago