•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 397,698 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,526 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
This tutorial shows how to greet your visitors depending on what time of day it is. If it's morning, it greets your visitor with "Good Morning!" If it's afternoon, it greets them with "Good Afternoon!" Magic? Noooo! Just PHP!
We will start by looking at the entire script and then dissecting it afterward.
The Tutorial of this so you cn understand will be piosted in the Tutorials Section of this site.
We will start by looking at the entire script and then dissecting it afterward.
The Tutorial of this so you cn understand will be piosted in the Tutorials Section of this site.
<?php //Here we define out main variables $welcome_string="Welcome!"; $numeric_date=date("G"); //Start conditionals based on military time if($numeric_date>=0&&$numeric_date<=11) $welcome_string="Good Morning!"; else if($numeric_date>=12&&$numeric_date<=17) $welcome_string="Good Afternoon!"; else if($numeric_date>=18&&$numeric_date<=23) $welcome_string="Good Evening!"; //Display our greeting echo "$welcome_string"; ?>
Comments (Newest First)
cscgal | The Queen of DaniWeb | Mar 30th, 2006
•
•
•
•
Haha!
Welcome back.
Welcome back. mikeSQL | Junior Poster | Mar 26th, 2006
Post Comment
•
•
•
•
DaniWeb Marketplace (Sponsored Links)