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

Objects in PHP Forum

View Course » View Exercise

712 points
528248adf10c60889600374e_733345347
Submitted by
Jackr0410
almost 4 years ago

1.9 "Did you create class Cat"

Hello all,

I have problems with 1.9 i looked up some answers but I can't get it working . Do you guys see anny problems ?

<?php
// Your code here
class Cat{
public $isAlive = true;
public $numLegs = 4;
public $name;

      public function __construct($name){
            $this->name = $name;
      }  
        function meow(){
            return "Meow meow";
        }
      };
        $cat1 = new cat("CodeCat");
        echo $cat1->meow();
    ?>

5 votes

permalink

class Cat {
public $isAlive = true;
public $numLegs = 4;
public $name;

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

      function meow() {
          return "Meow meow";
      }
  }

  $cat1 = new Cat("CodeCat");
  echo $cat1->meow();

1537 points
22988510868a95f108578e96f6fd2833?s=140&d=retro
Submitted by
penguinsk
almost 4 years ago

2 Comments

52b8efe88d8b4eb7abbcbbb8ad1f05d1?s=140&d=retro Caleb Canizalez over 3 years ago

gracias

52b8efe88d8b4eb7abbcbbb8ad1f05d1?s=140&d=retro Caleb Canizalez over 3 years ago

that means thank you


0 votes

permalink

The Code was good ! guess it was a connection problem ! post can be closed (:

712 points
528248adf10c60889600374e_733345347
Submitted by
Jackr0410
almost 4 years ago

1 Comment

Picture Hemant Kumar Goyal almost 4 years ago

Same problem :(