All pastes #520047 Raw Edit

Anonymous

public php v1 · immutable
#520047 ·published 2007-05-29 20:51 UTC
rendered paste body
	/**	 * 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);		}