<?php
class Dwarf {
public $name;
public $behavior;
function __construct($name, $behavior) {
$this->name = $name;
$this->behavior = $behavior;
}
function __destruct()
{
echo "The Dwarf is:<br> {$this->name} <br>and his behavior is:<br> {$this->behavior}<br><br>";
echo 'The class ' . __CLASS__ . ' is now destructed.<br>';
}
}
$nm = 'Happy';
$bh = 'This dwarf is always cheerful and happy about everything.';
$apple = new Dwarf($nm, $bh);
?>