PHP – Copyright Date

Save yourself some time each year and use PHP to update your copyright statements automatically.

Coding Solution

To update your copyright statements automatically, use this bit of php code in your footer.

<?php $today=date("Y"); ?>
<p id="copy">&copy; 2011 - <?php echo $today ?> All rights reserved</p>


The first line is PHP’s standard date function. Y says to use only the year.

Assign the year to the variable $today and echo $today in your copyright statement.

Next year your copyright will update itself keeping you current.