Using PHP to dynamically display the current year

Update 20-9-1012: As Kimonoki pointed out in the comments, this can actually be done in one line. There is no need to store the $time variable as the second parameter for date() is optional and defaults to time(). I have updated the snippet below.

I am posting this for reference for myself as I find it super handy but always forget. This snippet when added to your PHP page will display the current year which is really handy for copyright statements in page footers. After using this you will never forget to update the date again!

1
2
// displays the copyright symbol and the year
<p>&copy; <?php echo date("Y"); ?></p>