Home >> Snippet List >> Snippet

Name
What Season Is It?
Description
Simple PHP script tells you what season it is
PHP Snippet
<?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();
 
?>