I'm trying to do the following PHP. I have written it in English
if (today's date) => date1 AND <= date2 then {display image1}
elseif (today's date) => date3 AND <= date4 then {display image2}
else {display image 13}
There are 24 fixed dates and 13 fixed images.
I have tried using combinations of strtotime(), replacing the date value with variables, hard coding the dates within the program. I don't seem to be able to get any combination to work properly. I'm sure it's just a syntax error but I can't see it. When I've searched the web all the answers I've found relate to dates within databases but as I only have 24 dates it seems a bit of overkill. I would appreciate any pointers to the correct method I might be able to use. The dates need only a day and month as I would like this to repeat year after year.
<?php
$today = strtotime(date('d-m'));
if (strtotime($today) >= strtotime('28-10') && strtotime($today) <= strtotime('24-11')) {echo "<div>image1</div>";}
elseif (strtotime($today) >= strtotime('25-11') && strtotime($today) <= strtotime('22-12')) {echo "<div>image2</div>" ;}
elseif (strtotime($today) >= strtotime('23-12') && strtotime($today) <= strtotime('24-02')) {echo "<div>image3</div>" ;}
else {echo "<div>image13</div>";}
?>
The result I get from this is image1 appears on the web page but I would expect image3 as today is 22-01
Thank you in advance.
Andrew