計算一個程序的執行時間的函數
來源:程序員人生 發布時間:2014-04-01 11:08:20 閱讀次數:3809次
計算一個程序的執行時間的函數
- function getmicrotime(){
- list($usec, $sec) = explode(" ",microtime());
- return ((float)$usec (float)$sec);
- }
-
- $time_start = getmicrotime();
-
- for ($i=0; $i < 1000; $i ){
-
- }
-
- $time_end = getmicrotime();
- $time = $time_end - $time_start;
-
- echo "Did nothing in $time seconds";
生活不易,碼農辛苦
如果您覺得本網站對您的學習有所幫助,可以手機掃描二維碼進行捐贈