note 70747 deleted from function.date by danbrown

From: Date: Sun, 20 Jul 2008 02:54:41 +0000
Subject: note 70747 deleted from function.date by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-141999@lists.php.net to get a copy of this message
Note Submitter: Lionel ---- my quick and dirty code to find the season of the current date <?php function season() { $limits=array('/12/21'=>'Winter', '/09/21'=>'Autumn', '/06/21'=>'Summer', '/03/21'=>'Spring', '/01/01'=>'Winter'); foreach ($limits AS $key => $value) { $limit=date("Y").$key; if (strtotime($adate)>=strtotime($limit)) { return $value; } } } echo season(); ?> PS: the 21th is a good approach but not the real day.

« previous php.notes (#141999) next »