Home  >  Article  >  Backend Development  >  PHP gets the system startup time length example code_PHP tutorial

PHP gets the system startup time length example code_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:41:19967browse

PHP gets the system startup time length example code

  1. //Calculation of system startup time.
  2. $UPTIME = 32936982.68 ;
  3. $DAY = floor(($UPTIME / 86400)*1.0) ;
  4. $cal_day = $DAY * 86400 ;
  5. $cal_hour = $UPTIME - $cal_day ;
  6. $hour = floor(($cal_hour / 3600)*1.0) ;
  7. if ($hour < 10) {
  8. $hour = "0". $hour ;
  9. }
  10. $cal_tmp = $hour * 3600 ;
  11. ($cal_min / 60)*1.0) ;
  12. if ($min < 10) {
  13. $min = "0".$min ;
  14. }
  15. $cal_sec = $min * 60 ;
  16. $sec = floor(($cal_min - $cal_sec)*1.0) ;
  17. if ($min < 10) {
  18. $sec = "0".$sec ;
  19. }
  20. $ServerUptime = $DAY." day, ".$hour.":".$min." :".$sec ;
  21. echo result output: . $ServerUptime ;
  22. ?>
Result output: 381 days, 05:09:042

http://www.bkjia.com/PHPjc/486140.html

truehttp: //www.bkjia.com/PHPjc/486140.htmlTechArticlephp example code to obtain the system startup time?php //System startup time calculation. $UPTIME = 32936982.68; $DAY = floor(($UPTIME / 86400)*1.0) ; $cal_day = $DAY * 86400 ; $cal_hour = $UP...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn