Forum Moderators: coopster
can anyone tell me how i can use php to display one thing if the server time is between 18:00-22:00 and all other times it should display something else?
thanx
Parse error: parse error, unexpected T_STRING on the line that reads:
if ($time <18 ¦¦ $time > 22)
any ideas?
also, how about if i want a few different ranges?
e.g.
if time is between 14:00-15:00 display 1, if 15:-18:00 display 2 and if 18:00-22:00 display 3 else display other thing
thanx
if ($time <18 ¦¦ $time > 22)
{
echo "time is not between 18:00 - 22:00";
}
else
{
echo "time is between 18:00 - 22:00";
}
i want to add other ranges, such as 13:00-18:00, 22:00-04:00, 04:00-10:00
can anyone please tell me how i can do this?
thanx
<?
$time = date(H);
switch ($time) {
case ($time < 4):
echo "time is between 00:00 - 04:00";
break;
case ($time < 10):
echo "time is between 04:00 - 10:00";
break;
case ($time < 13):
echo "time is between 10:00 - 13:00";
break;
case ($time < 18):
echo "time is between 13:00 - 18:00";
break;
case ($time < 22):
echo "time is between 18:00 - 22:00";
break;
default:
echo "time is between 22:00 - 24:00";
break;
}
?>
you can always add cases as the need arises