Calculating PHP time difference (time ago)

It is a common problem in any CMS to show the last time a modification has been made. Our function will elaborate a bit on the PHP time difference and allow the user option of “accuracy” or show how many time intervals to be included in the “time ago” statement. For example if an article was posted 2 years 4 months 5 hours 33 minutes and 10 seconds ago we can limit the function to show only 1 level of accuracy – years or more.

Continue reading