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

Saturday, April 27, 2013

Codecademy Sample Solution: Property Panic (2)



<!DOCTYPE html>
<html>
<head>
 <title>Reconstructing the Person Class</title>
      <link type='text/css' rel='stylesheet' href='style.css'/>
</head>
<body>
      <p>
        <!-- Your code here -->
        <?php
            class Person{
                public $isAlive = true;
                public $firstname;
                public $lastname;
                public $age;
               
                public function __construct($firstname, $lastname, $age){
                    $this->firstname = $firstname;
                    $this->lastname = $lastname;
                    $this->age = $age;
                }
            }
            $teacher = new Person('boring', '12345', 12345);
            $student = new Person('Anony', 'mous', 100);
            echo $student->age;
        ?>
      </p>
    </body>
</html>

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts