Quantcast
Viewing all articles
Browse latest Browse all 426

Auto update to the current year in the copyright footer (© 2010-2013)

Tired of updating a whole bunch of site footers after New Year passed?
This snippet always displays the current year in the copyright line.

For example:

&copy; <?php
$startYear
= 2010;
$curYear = date('Y');
echo
$startYear . (($startYear != $curYear) ? '-'. $curYear : '');
?>
www.example.com

Results in:
© 2010-2013 www.example.com

If in a new website the current year is still the start year ($startYear = 2012), only one will be displayed. For example:
© 2012 www.example.com


Viewing all articles
Browse latest Browse all 426

Trending Articles