Default TemplateGreen TemplateBlue TemplateRed TemplateGold TemplateBlue Gloss Template
Article Categories

Mycities Network
PHP Scripts Examples and Tutorials
How do I greet web site visitors using php?

Thursday Nov 30, 2006
Greet your website visitors depending on server time: You may ask the question like:: How do I greet web site visitors using php? Ok here is the answer, this is a small code if you think properly.

<?
    $greeting = array("Good Morning", "Good Afternoon", "Good Evening");
        $LTime = date('H');
    if($LTime >="00" && $LTime < "12"){
        $greet = $greeting[0];
    }else if($LTime >="12" && $LTime < "18") {
        $greet = $greeting[1];
    }else if($LTime >="18" && $LTime < "23"){
        $greet = $greeting[2];
    }
    print $greet;
?>

Description:
$greeting is an array where it is holding 3 variable 0,1,2
date('H') will give you the currant time in hours 00-23

Author: Safras Ahamed



Comments : What do you think about this news?
No Comments yet.

POST COMMENT
Name
Message
  Post will be visible after admins approval
 

About Maldives Resorts

Members Login
User ID
Password
    Register
Forgot password?

Sri Lanka Toolbar
Listen to live Sri Lanka Radio, Watch Sri Lanka TV, Search Sri Lanka, Search Google, Sri Lanka New
Download Sri Lanka Toolbar FREE



Terms And Conditions | Link Directory

Join Sri Lanka Banner Exchange | Resources - Free Link Exchange