The following blocks of code is a program that changes the background color of the page base of the day from your computer.I used the Switch Statement instead of ifelse statement.
Colors are as follows:
Monday=Red
Tuesday=Yellow
Wednesday=Blue
Thursday=Green
Friday=White
Saturday=Violet
Sunday=Black
<?php
$date=date('l');
switch ($date){
case "Monday":
echo "Today is Monday";
echo "<body bgcolor='#FF0000'></body>";
break;
case "Tuesday":
echo "Today is Tuesday";
echo "<body bgcolor='#FFFF00'></body>";
break;
case "Wednesday":
echo "Today is Wednesday";
echo "<body bgcolor='#0000FF'></body>";
break;
case "Thursday":
echo "Today is Thursday";
echo "<body bgcolor='#006600'></body>";
break;
case "Friday":
echo "Today is Friday";
echo "<body bgcolor='##FF00FF'></body>";
break;
case "Saturday":
echo "Today is Saturday";
echo "<body bgcolor='#9900FF'></body>";
break;
case "Sunday":
echo "Today is Sunday";
echo "<body bgcolor='black'></body>";
break;
}
?>
$date=date('l');
switch ($date){
case "Monday":
echo "Today is Monday";
echo "<body bgcolor='#FF0000'></body>";
break;
case "Tuesday":
echo "Today is Tuesday";
echo "<body bgcolor='#FFFF00'></body>";
break;
case "Wednesday":
echo "Today is Wednesday";
echo "<body bgcolor='#0000FF'></body>";
break;
case "Thursday":
echo "Today is Thursday";
echo "<body bgcolor='#006600'></body>";
break;
case "Friday":
echo "Today is Friday";
echo "<body bgcolor='##FF00FF'></body>";
break;
case "Saturday":
echo "Today is Saturday";
echo "<body bgcolor='#9900FF'></body>";
break;
case "Sunday":
echo "Today is Sunday";
echo "<body bgcolor='black'></body>";
break;
}
?>
0 comments:
Mag-post ng isang Komento