I'm trying to make a script to display specific messages at specific day and time. I've got the script working to display at a specific day and at a specific time, but not the two combined.
How can I make the script display a specific message at mondays between 3pm and 4pm?
Look at the script I made so far;
<?php
//Messages
$afternoon = "It's afternoon";
$evening = "It's evening";
$night = "It's night.";
$morning = "It's morning!";
$friday = "Soon weekend!";
//Get time
$current_time = date(G);
//Get day
$current_day = date(l);
//12PM - 4PM
if ($current_time >= 12 && $current_time <= 16) {
echo $afternoon;
}
//5PM - 11PM
elseif ($current_time >= 17 && $current_time <= 24) {
echo $evening;
}
//00AM - 05AM
elseif ($current_time >= 1 && $current_time <= 5) {
echo $night;
}
//6AM - 11AM
elseif ($current_time >= 6 && $current_time <= 11) {
echo $morning;
}
//Friday, display message
if ($current_day == "Friday") {
echo $friday;
}
?>
I appreciate any help I can get!