protected static function time2String($timeline, $intervals)
    {
        $output = '';
        foreach ($intervals as $name => $seconds) {
            $num = floor($timeline / $seconds);
            $timeline -= ($num * $seconds);
            if ($num > 0) {
                $output .= $num . ' ' . $name . (($num > 1) ? 's' : '') . ' ';
            }
        }
        return trim($output);
    }
protected static function time2String($timeline, $intervals)
    {
        $output = '';
        foreach ($intervals as $name => $seconds) {
            $num = floor($timeline / $seconds);
            $timeline -= ($num * $seconds);
            if ($num > 0) {
                $output .= $num . ' ' . $name . (($num > 1) ? 's' : '') . ' ';
            }
        }
        return trim($output);
    }
protected static function time2String ( $ timeline , $ intervals ) { $ output = '' ; foreach ( $ intervals as $ name => $ seconds ) { $ num = floor ( $ timeline / $ seconds ) ; $ timeline -= ( $ num * $ seconds ) ; if ( $ num > 0 ) { $ output .= $ num . ' ' . $ name . ( ( $ num > 1 ) ? 's' : '' ) . ' ' ; } } return trim ( $ output ) ; }
Get elapsed time converted to string

Example Output:
1 year 5 months 3 days ago

@param integer $timeline elapsed number of seconds
@param array   $intervals configuration of time intervals in seconds

@return string
Get elapsed time converted to string