On Thu, 3 Oct 2002 14:43:37 -0700 (PDT), you wrote: >Hello, > >I was wondering if anyone has a good example of a way to do this. Kinda >lame, but like if the time is between 8am and 12pm, say "good morning", >between 12pm and 6pm, say good afternoon, and so on. > >I know this is probably pretty trivial, but I just wanted to see what >ideas where out there.
How about this: function getgreetingtime() { $hour = date("G"); switch(true) { case($hour < 12): $time = "morning"; break; case($hour >= 12 && $hour < 18): $time = "afternoon"; break; case($hour >= 18): $time = "evening"; break; } return $time; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php