Example #1
0
<?php

include_once 'Birds.php';
$bird = new Birds('Fluffy', '10', 'July 20, 2012', 'cockatoo');
$animal = $bird->showAnimalDetails();
$bird = $bird->showBirdDetails();
echo "\n<html>\n<head>\n<title>Animals</title>\n</head>\n<body>\n<div>\n\t<br>{$animal}, {$bird}</br>\n</div>\n</body>\n</html>";
Example #2
0
    public function move()
    {
        echo __METHOD__ . "=walk" . "<br/>";
    }
}
class Birds extends Animals
{
    public function move()
    {
        echo __METHOD__ . "=fly" . "<br/>";
    }
}
class Amphibias extends Animals
{
    public function move()
    {
        echo __METHOD__ . "=crawl" . "<br/>";
    }
}
$animal = new Animals();
$animal->move();
// the output will be "Animals::move"
$mammal = new Mammals();
$mammal->move();
// the output will be "Mammals::move=walk"
$bird = new Birds();
$bird->move();
// the output will be "Birds::move=fly"
$amphibia = new Amphibias();
$amphibia->move();
// the output will be "Amphibias::move=crawl"