close
轉自 http://blog.blueshop.com.tw/wataru/archive/2008/02/05/54283.aspx
要計算某行程式執行的時間,就找了一下
--
1 | <?php |
2 | function getmicrotime() |
3 | { |
4 | list($usec, $sec) = explode(" ",microtime()); |
5 | return ((float)$usec + (float)$sec); |
6 | } |
7 | |
8 | //例子 |
9 | |
10 | //開始 |
11 | $time_start = getmicrotime(); |
12 | |
13 | //這裡放你的代碼 |
14 | |
15 | //結束 |
16 | $time_end = getmicrotime(); |
17 | $time = $time_end - $time_start; |
18 | |
19 | echo "Did nothing in $time seconds"; //輸出總運行時間 |
20 | ?> |
view plain | print | ? |
--
全站熱搜
留言列表