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

Objects in PHP Forum

View Course » View Exercise

594 points
C0ab52132a94037383e9af5cd6b5be47?s=140&d=retro
Submitted by
Deji Ajayi
over 3 years ago

Putting It All Together, Part I

  <p>
        <!-- Your code here -->
            <?php
                class Dog {
                    public $numLegs = 4;
                    public $name;
                    public function _construct($name)  {
                       $this->name = $name;
                    }
                }
             ?>
      </p>

THis code doesnt run. Any thoughts

Edited By Gaurang Tandon to fix code formatting


1 vote

permalink

_construct => __construct.

2570 points
56ec11ba1ec4b00bc400069e_656519138
Submitted by
Gaurang Tandon
over 3 years ago

3 Comments

C0ab52132a94037383e9af5cd6b5be47?s=140&d=retro Deji Ajayi over 3 years ago

there should be a double underscore? is that what your saying?

56ec11ba1ec4b00bc400069e_656519138 Gaurang Tandon over 3 years ago

Yes.

Picture Ziana Nicole Mitchell about 3 years ago

yes! thank you! my code finally worked!!