<?php class benutzer { var $name; var $gebjahr;
function setName ($name) { $this->name = $name; }
function getName () { return $this->name; }
function setgebjahr ($gebjahr) { $this ->gebjahr = $gebjahr; }
function getAge () { return date ("Y") - $this->gebjahr; } }
$user = new benutzer; $user->setName ("Egon"); $user->setgebjahr(1954);
if (date('d.m.Y') == "12.02.2004") { echo "Hallo " . $user->getName() . "<br>Happy Birthday<br>Best wishes for Your " . $user->getAge() . ". birthday<br>"; } ?>
What if we extend the class a bit to store the exact birth date, so it would be able to trigger the echo on Egons birthdays? :) I would also like to join and wish a happy birthday to Egon!
Goba