Automatically Updating Copyright Year Using PHP

Code Snippet

There is an easy way to automatically update your copyright date using PHP so you don’t have to remember to do it every year. This can save you a lot of time if you have very many sites to update.

Current Year

Code

Example 1: &copy; <?php echo date("Y"); ?>

Example 2: Copyright &copy; <?php echo date("Y"); ?> All rights reserved.

Example Output

Example 1: © 2018

Example 2: Copyright © 2018 All rights reserved.

Year Range

Code

Example 1: &copy; 2008-<?php echo date("Y"); ?>

Example 2: Copyright &copy; 2008-<?php echo date("Y"); ?> All rights reserved.

Example Output

Example 1: © 2008- 2018

Example 2: Copyright © 2008- 2018 All rights reserved.

Usage

Place the code above wherever you want the copyright date displayed. If you’re using WordPress, you can put this in your child theme’s footer.