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

578 points
Submitted by
Ruhi Mukherjee
over 4 years ago

Parse error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION on line 26

My Code is getting submitted but is showing the error on line 26th

<!DOCTYPE html>

Challenge Time!

// Your code here
class Cat
public $isAlive = true;
public $numLegs = 4;
public $name;

          public function __construct($name)
              $this->name = $name;

          public function meow()
              return "Meow meow";
          $cat1 = new Cat("CodeCat");  //line 26
          echo $cat1->meow();

3 votes


It seems you are executing your $cat1 creation WITHIN the class definition itself.
Execute the code AFTER the closing-curly-bracket-for-the-class-definition AND before the closing PHP with "?>"

3701 points
Submitted by
about 4 years ago

1 Comment

E39786f437da6f566327b05ebf08c600?s=140&d=retro akash over 3 years ago