Created
April 4, 2018 19:41
-
-
Save reatlat/d46aa91b1e6bbd6461f9ed83aa135482 to your computer and use it in GitHub Desktop.
Automatic copyright year
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 | |
/** | |
* Automatic copyright year | |
* | |
* @link https://css-tricks.com/snippets/php/automatic-copyright-year/ | |
*/ | |
function autoCopyrightYear($year = 'auto') { | |
if(intval($year) == 'auto'){ $year = date('Y'); } | |
if(intval($year) == date('Y')){ echo intval($year); } | |
if(intval($year) < date('Y')){ echo intval($year) . ' - ' . date('Y'); } | |
if(intval($year) > date('Y')){ echo date('Y'); } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment