/** * Return uptime as a string * * Example: 60 days, 8 hours, 2 minutes, 7 seconds * * @return string */ public static function getAsString() { $uptime = self::get(); $uptime = array( // I'm careful hehe, lets make sure the order is right 'days' => $uptime['days'], 'hours' => $uptime['hours'], 'minutes' => $uptime['minutes'], 'seconds' => $uptime['seconds'] ); $uptimeString = array(); foreach ($uptime as $key => $time) { if (!$key == 'seconds' & $time < 1) { // some how less than zero :] continue; } $uptimeString[] = $time . ' ' . (($time == 1) ? substr($key, 0, -1) : $key); }