10 December 2011

How do I get the copyright notice to update year automatically?


I have a few little websites scattered around, and I noticed one of them had an outdated copyright notice. “Why doesn’t this update automatically?” I thought, then realised it’s easy with PHP- simply pop this in to your footer (or wherever you want it to appear):

&copy; Copyright My Website 2010 - <?php echo date("Y") ?>

Easy, huh?