- Michael Barton |
- PHP, Programming Languages, Tips |
- April 18th, 2009
I still see on a lot of sites the copyright date being outdated. Shoot, it was even outdated on mine. How embarrassing. Easy fix though. Something I do at work all the time, but since I’m not getting paid for this site, it wasn’t done.
Now, let’s forget the past and move onto the future.
The solution (in PHP):
1 2 3 4 | function copyright_year($year = '2009', $sep = '-') { $current_year = date('Y'); return ($year == $current_year) ? $year : $year . $sep . $current_year; } |
OR, for those that need more lines (I do too. I like to be able to READ my code):
[cc lang="php"]
function copyright_year($year = ’2009′, $sep = ‘-’) {
