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

Objects in PHP Forum

View Course » View Exercise

1175 points
A5ba1285e8142aa3740cc08378e41d6c?s=140&d=retro
Submitted by
Reianna-Bryant
about 2 years ago

Why does my correct code get a strange error message?

This is what my code looks like:
<?php
class Dog {
public $numLegs = 4;
public $name();
public function __construct($name) {
$this->name = $name;
}
}
?>

It passes just fine, it looks like the given hints, but for some reason, I get a strange error message in the panel box.
This is the message:
"Parse error: syntax error, unexpected '(', expecting ',' or ';' on line 12".

Can something explain if I'm doing something wrong, or if it is just the code itself?