function getmicrotime(){
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec (float)$sec);
}
$time_start = getmicrotime();//開始計時, 放在程序頭
for ($i=0; $i < 1000; $i ){
//do nothing, 1000 times
}
$time_end = getmicrotime();//結束計時, 放在尾部
$time = $time_end - $time_start;
echo "Did nothing in $time seconds";