Can anyone help me out on how to get this time dependent code to work. I
want it to display a greeting depending on the hour of the day (I'm trying
to convert my own Perl code to PHP with no luck on this one). I want it to
use the time of the local computer rather than the server.
Thanks
Dariusz
<?PHP
$greeting = array("Good morning", "Good afternoon", "Good evening");
$LTime = localtime(tm_hour);
if($LTime >= "0" && $LTime < "12")
{
$greet = $greeting[0]; # If morning print greeting Good Morning
}
elseif($LTime >= "12" && $LTime < "18")
{
$greet = $greeting[1]; # If 12 - 5 PM print greeting Good Afternoon
}
elseif($LTime >= "18" && $LTime < "23")
{
$greet = $greeting[2]; # If 6 - 11 PM print greeting Good Evening
}
echo "$greet";
?>