note 70745 deleted from function.date by felipe
| From: | felipe@php.net | Date: | Sun, 09 Dec 2007 13:38:24 +0000 |
| Subject: | note 70745 deleted from function.date by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-133002@lists.php.net to get a copy of this message | ||
Note Submitter: lcapt at dplanet dot ch
----
my quick and dirty code to find the season of the date
<?php
function season() {
$limits=array('/12/21'=>'Winter','/09/21'=>'Autumn',
'/06/21'=>'Summer','/03/21'=>'Spring','/12/31'=>'Winter');
foreach ($limits AS $key => $value) {
$limit=date("Y").$key;
if (strtotime("now")>strtotime($limit)) {
return $value;
}
}
}
echo season();
?>
PS: the 21th is a good approach but not the real day.