Update Copyright Date in PHP


/ Published in: PHP
Save to your folder(s)

Way to update the footer of a website automatically on 1st Jan.


Copy this code and paste it in your HTML
  1. <div id="footer">
  2. <p>&copy;
  3. <?php
  4. ini_set('date.timezone', 'Europe/London');
  5. $startYear = '2006';
  6. $thisYear = date('Y');
  7. if($startYear == $thisYear){
  8. echo $startYear;
  9. } else {
  10. echo $startYear.' &ndash '.$thisYear;
  11. }
  12. ?>
  13. Company Name Here</p>
  14. </div>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.