Re: birthday class

From: Date: Wed, 11 Feb 2004 19:09:11 +0000
Subject: Re: birthday class
References: 1 2  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969358921@lists.php.net to get a copy of this message
<?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

« previous php.doc (#969358921) next »