Virtually every website has a copyright icon and string indicating the years of website operation. It's surprising how many sites still use a single static date that doesn't reflect the years the site has existed. The following function is designed to return the date of website origin through to the current year.
1
<?php
2
/*
3
Add Automatic Copyright Year With PHP
4
http://www.beliefmedia.com/code/php-snippets/copyright-year
5
*/
6
7
function bm_copyright($year = '') {
8
9
10
}
11
12
/* Usage */
13
echo bm_copyright('2012');
Returns: © 2012 - 2017.
Of course, you can return the current year with just the following:
The from and to date can be returned with the following (the only difference to the function above is that it doesn't correct if the start and current year are the same).