Function to Generate a Copyright Since with PHP

Written by Richi González Monday, 25 February 2013

Hello,

When working with a website, I always try to make things the most automated I can so that I don’t need to be editing them often, that’s why here I present you a function I created that is used to return the years for the copyright notice, for example. It will print the year since the website started and the current year. Keep reading to see what I’m talking about!

1. Copy paste the following function to your functions file or, if you don’t have one, to the top of your PHP file.

//Function used to return years of copyright ie. 2012 - 2013
function Copyright() {
 $since = 2012; //The year since your website started
 $curr = date("Y"); //Current year (according to the server)
 if($curr == $since) { //If your company started in the current year, just return YYYY
  return $since;
   } else {
  return $since." - ".$curr; //YYYY - YYYY
 }
}

2. Edit the variable $since to match with the year your website started.

That’s it! The next picture is of a production website that uses the exact same function.copyright
There are endless possibilities of where you can use the function, your imagination is your limit!
Best Regards,

Richi

Owner of Juapo2Services

Looking for quality web hosting? Look no further than Arvixe Web Hosting!



2 Comments

  1. Jimoh Adeleke   |  Tuesday, 19 March 2013 at 11:35 pm

    Hey Richi,
    Thanks for your help recently. I have a question with facebook share on cb. My fb share button only shares link and website name, how can I make it share the actual video plus description?
    Also, I don’t know how to start a new question/topic on arvixe here

  2. Richi González   |  Monday, 01 April 2013 at 8:07 pm

    Hello,

    Sign up at forum.arvixe.com. Go to Clip-Bucket Software forum and start a topic. I will personally follow up your issue there!

    Regards,
    Richi

Leave a Reply






9 + nine =