计算一个程序的执行时间的函数
栏目:php教程时间:2014-04-01 11:08:20
计算一个程序的执行时间的函数
- 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";
------分隔线----------------------------
------分隔线----------------------------