Quotes help make search much faster. Example: "Practice Makes Perfect"

Saturday, April 27, 2013

Codecademy Sample Solution: Putting It All Together, Part II



<!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 __construct($name){
                    $this->name = $name;
                }
               
                public function bark(){
                    return "Woof!";
                }
               
                public function greet(){
                    return "My name is $this->name.";
                }
            }
           
            $dog1 = new Dog('Barker');
            $dog2 = new Dog('Amigo');
            echo $dog1->bark();
            echo $dog2->greet();
        ?>
      </p>
    </body>
</html>

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts