RBA Cash Rate: 4.35% · 1AUD = 0.67 USD · Inflation: 4.1%  
Leading Digital Marketing Experts</strong | 1300 235 433 | Aggregation Enquires Welcome | Book Appointment
Example Interest Rates: Home Loan Variable: 5.69% (5.89%*) • Home Loan Fixed: 5.39% (5.84%*) • Fixed: 5.39% (5.84%*) • Variable: 5.69% (5.89%*) • Investment IO: 5.69% (6.19%*) • Investment PI: 5.49% (5.98%*)

Add Automatic Copyright Year With PHP

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
  if ($year == '') return '© ' . date('Y');
9
 return ( $year == date('Y') ) ? '© ' . $year : '© ' . $year . ' - ' . date('Y');
10
}
11
 
12
/* Usage */
13
echo bm_copyright('2012');

Returns: © 2012 - 2017.

Of course, you can return the current year with just the following:

1
<?php 
2
echo '© ' . date('Y');

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).

1
<?php 
2
echo '© 2012 - ' . date('Y');

■ ■ ■

 
Download our complimentary 650-page guide on marketing for mortgage brokers. We'll show you exactly how we generate billions in volume for our clients.
Finance Guide, Cropped Top and Bottom
  Timezone: 1 · [ CHANGE ]

Like this article?

Share on Facebook
Share on Twitter
Share on Linkdin
Share on Pinterest

Leave a comment