Function to Generate a Copyright Since with PHP

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!

Tags: , , , , , , , , , | Posted under Programming/Coding | RSS 2.0

Author Spotlight

Richi González

Richi González

I started programming when I was 12. I'm a Developer and have been working with the Clip-Bucket script since it came out. I became a Liaison between Arvixe and Clip-Bucket, so I am here to assist you with anything you need regarding Clip-Bucket or any particular computer-related subject you need. Best Regards, Richi

2 Comments on Function to Generate a Copyright Since with PHP

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

Leave a Reply

Your email address will not be published. Required fields are marked *


8 + = 9

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>