Created
October 14, 2015 10:43
-
-
Save dotZak/b134b46ca67f90a9b50c to your computer and use it in GitHub Desktop.
PHP: Return string of origin year to the current year
This file contains hidden or 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
function origin_year_to_current_year( $origin_year, $sep = '-', $after = '' ) | |
{ | |
$date_range = $origin_year; | |
if( date('Y') != $origin_year ) | |
{ | |
$current_year = date('Y'); | |
$date_range = $current_year . $sep . date('Y'); | |
} | |
$return = $date_range . $after; | |
return $return; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment