Last Updated: February 25, 2016
·
1.012K
· mikeballan

Dynamic footer year

Had to make some updates to a website the other day that was made before we built sites using PHP includes which means i had to change at least 20 pages all becaude the footers date was wrong..!

Now these days when i’m building a website that needs a date in the footer i use a simple bit of PHP code which means you will never need to update it.

<?php echo date("Y"); ?>

And that is all the code you need to print the current year.

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Related Tags
#php
Did you know?

PHP applications still send a browser full of JavaScript. Hardening the server does not inventory the payment, analytics, and plugin scripts that run after the HTML is delivered.

Security insights from Cside