Skip to content

Instantly share code, notes, and snippets.

@unfulvio
Last active August 29, 2015 13:56
Show Gist options
  • Save unfulvio/9042824 to your computer and use it in GitHub Desktop.
Save unfulvio/9042824 to your computer and use it in GitHub Desktop.
Just a self updating copyright year range
<?php
/**
* Copyright Years
* Outputs an years range based on specified year to current year
*
* @param int $copyYear - the year since the copyright starts (should be lower than current year)
* @return string - a range of years (eg. "2000-2010")
*/
function copyright( $copyYear ) {
$curYear = date( 'Y' );
$copyYear = is_int( $copyYear ) ? $copyYear : $curYear;
$copyright = $copyYear . ( ( $copyYear != $curYear && $copyYear < $curYear ) ? '-' . $curYear : '');
return $copyright;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment