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

Objects in PHP Forum

View Course » View Exercise

1175 points
Submitted by
over 2 years ago

What does my code pass with no results shown?

This is how my code looks:
class Dog {
public $numLegs = 4;
public $name();
public function _construct($name) {
$this->name = $name;
public function _
bark() {
return "Woof!";
public function __greet() {
return "Hello, I am " . $this->name . " the dog.";

    $dog1 = new Dog("Barker");
    $dog2 = new Dog("Amigo");

    echo $dog1->bark();
    echo $dog2->greet();

It passes fine, but I get this in the result window:
" Parse error: syntax error, unexpected '(', expecting ',' or ';' on line 12".

Is it something I'm doing, or is the computer programming acting up? Please let me know.