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

922 points
52983e67abf821c6b5005d7f_23743677
Submitted by
Jane Cui
about 5 years ago

[resolved] 5/10 Parse error: syntax error, unexpected TCLASS, expecting TFUNCTION

Property Panic (2)

The code works, but it gets "Parse error: syntax error, unexpected TCLASS, expecting TFUNCTION on line 19"

why?

   <?php

    class Person{

        public $isAlive = true;
        public $firstname;
        public $lastname;
        public $age;

        class function __construct($firstname, $lastname, $age){
            $this->firstname=$firstname;
            $this->lastname=$lastname;
            $this->age=$age;)
    };

    $teacher = new Person("boring", "12345", 12345);
    $student = new Person("Jane", "Cui", "24");

    echo $student->age;

    ?>

1 vote

permalink

Hi Jane, it looks like you closed your __construct method with a ) instead of a }

3698 points
55df2afa95e3787b9200005e_359368177
Submitted by
Judy
about 5 years ago

2 Comments

52983e67abf821c6b5005d7f_23743677 Jane Cui about 5 years ago

thanks.

55df2afa95e3787b9200005e_359368177 Judy about 5 years ago

You're welcome.