<?php
class Dwarfs {
/* Properties */
public $name;
public $behavior;
public $friend;
public $age;
/* Methods */
function __construct($name, $behavior, $friend, $age)
{
$this->name = $name;
$this->behavior = $behavior;
$this->friend = $friend;
$this->age = $age;
}
public function get_name()
{
return $this->name;
}
public function get_behavior()
{
return $this->behavior;
}
public function get_friend()
{
return $this->friend;
}
public function get_age()
{
return $this->age;
}
}
$nm = 'Happy';
$bh = 'This dwarf is always cheerful and happy about everything.';
$fr = 'Snow White friend';
$ag = '1937 - Year of the first performance of "Snow White and the Seven Dwarfs"';
$dwarf = new Dwarfs($nm, $bh, $fr, $ag);
echo $dwarf->get_name();
echo '<br><br>';
echo $dwarf->get_behavior();
echo '<br><br>';
echo $dwarf->get_friend();
echo '<br><br>';
echo $dwarf->get_age();
echo '<br><br>';
?>