This is a very simple script to automatically update your copyright notification every Jan 1st. It uses PHP's versatile
date() function to extract the year from the current date then print it to the user's browser.
This example is very simplified. In a real world situation you would probably include some HTML in the echo statement to format the output to the browser.
PHP Code:
<?php
$year = date("Y");
echo "Copyright © $year";
?>
The is another way to achieve the same result. Depending on how the rest of the page is structured, this may be a more appropriate method.
PHP Code:
<p>Copyright © <?php echo date("Y"); ?></p>
The advantage of the second method is that if you are using a WYSIWYG editor e.g. Dreamweaver to edit the page, you have something to work with in design view. With the first method nothing will show in design view, everything will have to be coded by hand.