logo Lee Johnson SEO

PHP Time for a Welcome to Your Visitors

Make your homepage a welcoming by adding a time related intro.

You can see an example at leejohnson.it

Check out the purple section to show what time of day the server is showing to the visitor. It makes the page content change several times a day and it weels welcoming.

<?
$welcome_string="Welcome!";
$numeric_date=date("G");
// Between 12am-3am
if($numeric_date>=0&&$numeric_date<=3)
$welcome_string="Hi night owl";
// Between 4am-11am
else if($numeric_date>=4&&$numeric_date<=11)
$welcome_string="Good morning";
// Between 12pm-4pm
else if($numeric_date>=12&&$numeric_date<=16)
$welcome_string="Good afternoon";
// Between 5pm-11pm
else if($numeric_date>=17&&$numeric_date<=23)
$welcome_string="Good evening";
echo "$welcome_string";
?>