Changing page background in PHP according to time

images php coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
User avatar
Patfreeze
New php-forum User
New php-forum User
Posts: 41
Joined: Tue Apr 20, 2010 9:51 am
Location: Canada - Quebec
Contact:

Tue Apr 20, 2010 10:12 am

Check my comment on the code

Code: Select all

<?php
$hour = date('H');
if ($hour < 12 ) { /***** if $hour is between 0 to 12 ****/
    echo '<link rel="stylesheet" type="text/css" href="style.css" />;
}
else if ($hour > 13 AND $hour < 17 ) { /***** if $hour is between 12 to 16 ****/
    echo '<link rel="stylesheet" type="text/css" href="style2.css" />';
}
else if ($hour < 18 ) { /***** if $hour is between 17 to 24 ****/
    echo '<link rel="stylesheet" type="text/css" href="style3.css" />';
}
else {
	echo 'You messed up man.'; /***** supose that $hour not defined ****/
}
?>
hope that will help you :D

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest