Skip to content

Instantly share code, notes, and snippets.

@LibertysYarn
Created October 21, 2013 20:18
Show Gist options
  • Save LibertysYarn/7090246 to your computer and use it in GitHub Desktop.
Save LibertysYarn/7090246 to your computer and use it in GitHub Desktop.
Automatic Copyright Year - CSS-Tricks
&copy; <?php echo date("Y") ?>
<?php function auto_copyright($year = 'auto'){ ?>
<?php if(intval($year) == 'auto'){ $year = date('Y'); } ?>
<?php if(intval($year) == date('Y')){ echo intval($year); } ?>
<?php if(intval($year) < date('Y')){ echo intval($year) . ' - ' . date('Y'); } ?>
<?php if(intval($year) > date('Y')){ echo date('Y'); } ?>
<?php } ?>
<?php auto_copyright(); // 2011?>
<?php auto_copyright('2010'); // 2010 - 2011 ?>
&copy; 2008-<?php echo date("Y") ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment