Copyright Date in PHP

Posted: December 29, 2007

I came across a site where, every year, the copyright date in the footer had to be manually updated on every page! With PHP, the following snippet of code can be used so that the date automatically gets updated each year:

Copyright <? echo date(“Y”); ?>

Voila. PHP takes the year from the server, so as long as your host’s server has the correct date, you’ll never have to update the copyright date again.

Leave a Reply

Your email address will not be published. Required fields are marked *