public static function timeDiff($timestamp)
    {
        $dateRef = new \DateTime('@' . $timestamp);
        $dateNow = new \DateTime();

        $dateDiff = $dateNow->diff($dateRef);

        return [
        'past_time'  => $dateDiff->invert,
        'year'       => $dateDiff->y,
        'month'      => $dateDiff->m,
        'day'        => $dateDiff->d,
        'hour'       => $dateDiff->h,
        'minute'     => $dateDiff->i,
        'second'     => $dateDiff->s,
        'days_total' => $dateDiff->days,
        ];
    }
public static function timeDiff($timestamp)
    {
        $dateRef = new \DateTime('@' . $timestamp);
        $dateNow = new \DateTime();

        $dateDiff = $dateNow->diff($dateRef);

        return [
        'past_time'  => $dateDiff->invert,
        'year'       => $dateDiff->y,
        'month'      => $dateDiff->m,
        'day'        => $dateDiff->d,
        'hour'       => $dateDiff->h,
        'minute'     => $dateDiff->i,
        'second'     => $dateDiff->s,
        'days_total' => $dateDiff->days,
        ];
    }
public static function timeDiff ( $ timestamp ) { $ dateRef = new \ DateTime ( '@' . $ timestamp ) ; $ dateNow = new \ DateTime ( ) ; $ dateDiff = $ dateNow -> diff ( $ dateRef ) ; return [ 'past_time' => $ dateDiff -> invert , 'year' => $ dateDiff -> y , 'month' => $ dateDiff -> m , 'day' => $ dateDiff -> d , 'hour' => $ dateDiff -> h , 'minute' => $ dateDiff -> i , 'second' => $ dateDiff -> s , 'days_total' => $ dateDiff -> days , ] ; }
Calculates time difference between current time and specified timestamp
and returns array with human readable properties of time interval

@param integer $timestamp
@return array
Calculates time difference between current time and specified timestamp and returns array with human readable properties of time interval