I am trying to run a php script which would return the name of a specific icon, depending on the day.
I have added this special method which computes the Easter day (Sunday).
Now, I have added a special case for today (17.08), just to test my algorithm. However, my $returnValue does not return the icon that I would like (i.e. assets/icons/logo_halloween.png) ... I know it's not halloween yet, but come on ;-)
I am probably doing something wrong here with my structure of the if's. Would be glad if you could assist me on this. Thanks a lot in advance.
function getIconFileName()
{
$iconPath = "assets/icons/";
$returnValue = ".";
// gets current year and stores it in a variable
$year = date('Y');
// Calcul des dates variables (Pâques)
// gets the Easter Sunday
$date_Easter_Sunday = easter_date($year);
if ((date('m') == (date('m', $date_Easter_Sunday))) && (date('d') == (date('d', $date_Easter_Sunday))))
{
// Dimanche de Pâques
$returnValue = $iconPath . "logo.png";
}
elseif ((date('m') == 08) && (date('d') == 17))
// ---> It looks like my code never returns this value (logo_halloween.png) <----
{
$returnValue = $iconPath . "logo_halloween.png";
}
// Calcul des dates fixes
elseif ((date('m') == 01) && (date('d') == 01))
{
// Premier jour de l'an
$returnValue = $iconPath . "logo.png";
}
elseif ((date('m') == 03) && (date('d') == 21))
{
// Premier jour du printemps
$returnValue = $iconPath . "logo.png";
}
else
{
// Ceci est un jour normal
$returnValue = $iconPath . "logo.png";
}
echo "Path to icon : " . $returnValue . "<br>";
return $returnValue;
}
" +1 day"with" next monday"and" -2 day"with" last friday"maybe that helps