Last active
June 7, 2018 07:02
-
-
Save niravmadariya/edbcfea9ff381d806b8952c7ffefe10e to your computer and use it in GitHub Desktop.
Greet user based on time
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
date_default_timezone_set('Asia/Kolkata'); | |
$hour=date('h', time()); | |
$ampm=date('a', time()); | |
if($ampm=="am"){ | |
if($hour>=1 && $hour<=11){ | |
echo "Good Morning!!!"; | |
} | |
} | |
else if($ampm=="pm"){ | |
if(($hour>=1 && $hour<=4) || $hour==12){ | |
echo "Good Afternoon!!!"; | |
} | |
else if($hour>=4 && $hour<=9){ | |
echo "Good Evening!!!"; | |
} | |
else{ | |
echo "Good Night!!!"; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment