Adding and IF to my PHP

Permalink
On my C5 site I have a line of code which pulls the date which a page was created and returns how long ago it was create. This all works great whoever I need to change this so when it becomes e.g. 20 minuets and old a custom message is displayed.

This is my code currently:
$time = strtotime($LogDateTime);
$LastReported = humanTiming($time);
function humanTiming ($time) {
    $time = time() - $time;
    $time = ($time<1)? 1 : $time;
    $tokens = array (
        31536000 => 'year',
        2592000 => 'month',
        604800 => 'week',
        86400 => 'day',
        3600 => 'hour',
        60 => 'minute',
        1 => 'second'
    );
    foreach ($tokens as $unit => $text) {


How can I modify this?

 
Mainio replied on at Permalink Reply
Mainio
Not sure exactly what you are trying to ask here but Stack Overflow is pretty good usually for this sort of stuff:
http://stackoverflow.com/a/18602474...

https://i.imgur.com/wOsEq7N.png...

This website stores cookies on your computer. These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media. To find out more about the cookies we use, see our Privacy Policy.