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

Objects in PHP Forum

View Course » View Exercise

410 points
558933379376760a840004be_367921115
Submitted by
Marius
almost 2 years ago

7/10 class error. help

<!DOCTYPE html>
<html>
    <head>
      <title> Practice makes perfect! </title>
      <link type='text/css' rel='stylesheet' href='style.css'/>
    </head>
    <body>
      <p>
    <?php
     class dog {



        public $numLegs = 4;
        public $name;

        public function __construct() {
         $name = $name ;
        }
     }
    ?>
      </p>
    </body>
</html>

Keeps telling me this : Oops, try
again. Did you create a 'Dog' class?


2 votes

permalink

First, Fix your class name as Dog ("D" should be upper), and then i just find your inner method seems missing. Just try code bellow:

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

1349 points
56d8465d3b55eac00f00013d_426623443
Submitted by
Wirandraw
almost 2 years ago


1 vote

permalink

Dog is capitalized. Use a capital 'D'. These courses are case sensitive most of the time.

375 points
51db8388631fe938e5001928_379261218
Submitted by
KingSwayne
almost 2 years ago