Last active
August 29, 2015 13:56
-
-
Save unfulvio/9042824 to your computer and use it in GitHub Desktop.
Just a self updating copyright year range
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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