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

Objects in PHP Forum

View Course » View Exercise

1073 points
56c6df404a69251081000402_907100238
Submitted by
Ali Marwan
about 2 years ago

8/10 I don't see your __contruct() anymore!!!!????? what's wrong with my code then.....

<!-- Your code here -->

    <?php

    class Dog {

    public $numLegs=4;
    public $name;
    public function __contruct($name) {
        $this->name = $name;
        }

    public function bark() {
        return "Woof!";
        }

    public function greet() {
        return "Hi this is" . $this->name . " " . "Is here for your service"; 
        }
    }

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

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

2 votes

permalink

conStruct

1178 points
57ec043158212274a8000433_579504586
Submitted by
Daniel G
about 2 years ago


0 votes

permalink

omg............ i'm so blind!

Thanks man haha

1073 points
56c6df404a69251081000402_907100238
Submitted by
Ali Marwan
about 2 years ago

2 Comments

57ec043158212274a8000433_579504586 Daniel G about 2 years ago

no problem happens...

068d769c9238039d620851022ddbab68?s=140&d=retro domodaniel about 2 years ago

same. it drives me crazy w/ spelling mistakes in coding