Automatically Update The Year in PHP

It’s quite easy to update the year in your footer with PHP, we can just use the date() function.

To output the current year alone.

<p><?php echo date("Y") ?></p>

To output the current year with a starting year, separated by an en dash.

<p>2002 &ndash; <?php echo date("Y") ?></p>

Post a Comment

To post code, use the code tag with a class language-*
Examples: code class="language-markup"code class="language-css"