/ Published in: PHP
Expand |
Embed | Plain Text
<?php /** * Copydate * Returns a year for a copyright section of a website * Return is in the format starYear-currentYear (e.g. 1999-2009) * Give the parameter for startYear, currentYear is automaticly filled * If the startYear is the same as the currentYear or higher currentYear is returned * If startYear is not a valid year, currentYear is returned * * @param string|int $starYear The year when the content was created * @return string The parsed output as described * * @copyright (c) 2009, neobird * @license http://www.opensource.org/licenses/mit-license.php MIT license * * @version 2 */ function copydate($startYear) { //code:neobird-copydate-2/date-copyright-year return (!ctype_digit((string)$startYear) || $startYear >= date('Y')) ? (string) date('Y') : $startYear.'-'.date('Y'); } ?>
You need to login to post a comment.
