Ask a question »

PHP - Change the greetings message on you website

May 2016


Change the greeting message on you website according the the time of the day.
Well it would be quite Inappropriate to dispaly a "Hello Good Morning" in an article of your website at nigh-time.


  • It is possible to remedy this through the language that is PHP.
  • Here's a little script that will display "Good morning" or "Good evening" according to the time of the day.
  • Insert this code your HTML source:

  • This script works for a schedule. It does not fit in time zone differences. So it does not fit to the time zone of visitor.

Thanks to le petit marocain for this tip.

For unlimited offline reading, you can download this article for free in PDF format:

See also

In the same category

Published by deri58.
This document entitled « PHP - Change the greetings message on you website  » from CCM ( is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.