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

Objects in PHP Forum

View Course » View Exercise

795 points
513030b7e9ca165875004adb_445800232
Submitted by
Spencer Carter
about 3 years ago

Why does it say I haven't added the <?php ?> tags?

I have tried this code a few times, and each time, it tells me to check and see if i have my <?php ?> tags. They're there every time, but I still cannot pass. Can somebody explain and help me?

<!DOCTYPE html>
<html>
    <head>
      <title> Practice makes perfect! </title>
      <link type='text/css' rel='stylesheet' href='style.css'/>
    </head>
    <body>
      <p>
        <!-- Your code here -->
        <?php 
        class Dog{
            public $numLegs = 4;
            public $name;
            public function __constructor($name){
              $this->name = $name;
            }
          }
        ?>
      </p>
    </body>
</html>

Edited By Gaurang Tandon to fix code formatting


2 votes

permalink

When it says add your php tags on line 9, it's not kidding. Delete the "<!-- Your code here -->" and replace it with "<?php".

I had the same problem.

2427 points
A5e30855fb21dd9d4964e4cfcaac9cfd?s=140&d=retro
Submitted by
blue_mage
about 3 years ago

1 Comment

D74f3e8f6ac51c03fee857f664b33d34?s=140&d=retro sofiabeans27 about 2 years ago

wow whoa why this that ! lol thank u so much!