mercredi 11 décembre 2019

PHP date condition on nested ifelse [duplicate]

This question already has an answer here:

Right, probably an easy one, but im having a blond moment and scratching my head.

<?php
        date_default_timezone_set('Europe/London'); 
        $today = date('d-m');


                if(($today >= '01-11') && ($today <= '20-11')) 
                    { 
                        echo "<p class='rememberance'>&nbsp;</p>";
                    }
                elseif (($today >= '2-12') && ($today <= '25-12')) 
                    {
                        echo "<p class='christmas'>&nbsp;</p>";
                    }
                elseif (($today >= '01-01') && ($today <= '09-01')) 
                    {
                        echo "<p class='new-year'>&nbsp;</p>";
                    }
                elseif (($today >= '01-04') && ($today <= '19-04')) 
                    {
                        echo "<p class='easter'>&nbsp;</p>";
                    }
                elseif (($today >= '01-06') && ($today <= '19-07')) 
                    {
                        echo "<p class='yearend'>&nbsp;</p>";
                    }
                else
                    {
                    echo "<p class='normal'>&nbsp;</p>";
                    }
        ?>

I have some CSS rules set to display a little image based on the banding that the php outputs, now currently it is only showing the rememberance class! Can anyone help!!? Cheers

Aucun commentaire:

Enregistrer un commentaire