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

Objects in PHP Forum

View Course

692 points
55f6bbb9937676b0aa00059e_129087668?awsaccesskeyid=akiajkz7qvqfd72xnj3q&expires=1511544971&signature=j6mq6kvfx08ti8atc8w%2bo6txotq%3d
Submitted by
Darkhorse
about 2 years ago

Wheel of death continuous forever 9/10 - what's wrong with my cat name?(Error)

Wheel of death continuous forever 9/10 - what's wrong with my cat name?(Error states I haven't called it CodeCat).

<!DOCTYPE html>


Challenge Time!




<?php
class Cat{
public $isAlive = true;
public $numLegs = 4;
public function __construct($name){
$this->name = $name;
}
public function meow() {
return "Meow meow";
}
}
$cat1 = Cat("CodeCat");
echo $cat1->meow(). "";
?>


0 votes

permalink

Hi! You just have two-three little mistakes, It should be like this:

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

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

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

}

    $cat1 = new Cat("CodeCat");

    echo $cat1-> meow();    

506 points
560b113a51b887d43200029e_278947597
Submitted by
Joni Bolkvadze
about 2 years ago