<?php
function GetCurrentSeason() {
$seasonDates = array('/12/21'=>'winter',
'/09/21'=>'autumn',
'/06/21'=>'summer',
'/03/21'=>'spring',
'/01/01'=>'winter');
foreach ($seasonDates AS $seasonKey => $seasonValue)
{
$seasonDate = date("Y").$seasonKey;
if (strtotime("now") > strtotime($seasonDate))
{
return $seasonValue;
}
}
}
$returnCurrentSeason = GetCurrentSeason();
?>
<section class="demo-section">
<div class="demo-container">
<div class="demo-content" style="background-image: url(images/<?php echo $returnCurrentSeason; ?>.jpg);">
<div class="demo-caption">It is <?php echo $returnCurrentSeason; ?> now</div>
</div>
</div>
</section>
.demo-content {
padding: 3rem 1rem 1rem 1rem;
min-height: 360px;
background-repeat: no-repeat;
background-position: center;
background-size: cover;
}