Designing and Development > Programming
PHP 5.3 - Decision of Strings (GM, GA, GE, GN decider)
(1/1)
Tayab:
Hello I've just created another script which decides whether to sat Good Morning, Afternoon, Evening, Night at suitable country. It's basic script with the complication in Hours. I might be wrong somewhere in hours according to my math skills. :P
--- Code: ---<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1-sttrict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Hello</title>
</head>
<body>
<?php
$hour = date( "G" );
$year= date( "Y" );
if ( $hour >= 5 && $hour < 12 ) {
echo "<h1>Good Morning!</h1>";
} elseif ( $hour >= 12 && $hour < 18 ) {
echo "<h1>Good Afternoon!</h1>";
} elseif ( $hour >= 18 && $hour < 22 ) {
echo "<h1>Good Evening!</h1>";
}else {
echo "<h1>Good Night!</h1>";
}
?>
</body>
</html>
--- End code ---
phpdeveloper:
good job script is well no doubt and any one can change the hours to according his/her time when he /she want to show (GM,GA,GE,GN )
thanks tayab to sharing with us . hope it will work well for other ....
Tayab:
Thanks for your reply back of appreciation. Due to my busy schedule I was packed from 4s, along with I am working on something else too so I am unable to give sometime to it. But am planning to change it to dynamic (will show the time according to person's GMT) and hoping you will help me wherever I stuck. Secondly, I also will be creating fascinating things into PHP as along.
phpdeveloper:
Your welcome Tayab we are always ready to help you and best of luck for your dreams :) :) :)
Navigation
[0] Message Index
Go to full version