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

Objects in PHP Forum

View Course » View Exercise

686 points
Eb1c03025532f4197c30f11a50438b5e?s=140&d=retro
Submitted by
danweller18
over 3 years ago

7/10 Putting It All Together, Part I - $numLegs question

why does it not like a space between $numLegs = 4; ? I got an error with my code until I changed it to $numLegs= 4; Does the PHP language not like the space?

Full working code:

<p>
    <?php
      class Dog {
          public $numLegs= 4;
          public $name;
          public function __construct($name){
              $this->name = $name;
          }
      }
    ?>
</p>

0 votes

permalink

php actually i dont think minds i think here they just assumed your = was part of the var

605 points
9103d458102b9076ea71e02b119a03f2?s=140&d=retro
Submitted by
cr1tical
over 3 years ago