Posts

Keep copyright up to date

At the footer of many webpages you will find the line

Copyright “YEAR” Company Name

or

Copyright “YEAR” – “YEAR” Company Name

and more than once you will find these years are incorrect.

With just a few lines of code in your footer.php file, you can keep the copyrights up to date automatically.

 
 
<div class="site-info">
   <?php 
     $startYear = 2013; //replace with your own value
     $currentYear = date("Y");
     if ( $startYear == $currentYear ) {
       $yearString = $startYear; 
     } else {
       $yearString = $startYear . ' - ' . $currentYear; 
     }    
     echo "Copyright $yearString Company Name"; 
   ?>
</div><!-- .site-info -->
 
link-to-php-article

Function ereg_replace() is deprecated

PHP Warning: Function ereg_replace() is deprecated. Now what?
Read more