Automatic Update Copyright Year

Still wonder how to automatic update copyright year instead of changing hard-coded value each year. Lol!! You need some fresh air to let your mind breathe. Use PHP’s date() function which can echo the current year in your copyright text.

 There are many variations of the same code above. if you are using a start year as well then:

Or can use either like this while developing website initially

Choice is yours! Core is just use date('Y') function to let PHP update year automatically in your copyright text. 

As a note: Don’t use  jQuery or JavaScript to  automatic update copyright year because  it’s prone to abuse or great error as you’d be relying on the end user’s PC to have the right time unless you were using AJAX to pull the real time from the server.

You Might Interested In

1 COMMENT

Leave a Reply

Enclose a code block like: <pre><code>Your Code Snippet</code></pre>.