RE: [PHP-DOC] birthday class

From: Date: Wed, 11 Feb 2004 18:50:01 +0000
Subject: RE: [PHP-DOC] birthday class
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969358922@lists.php.net to get a copy of this message
Egon and Zeev are twins? wild.. > -----Original Message----- > From: Gabor Hojtsy [mailto:gabor@hojtsy.hu] > Sent: 11 February 2004 19:09 > To: Cornelia Boenigk > Cc: PHP DOC > Subject: Re: [PHP-DOC] birthday class > > > > <?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 (#969358922) next »