<?php /** * 測試php執行時間 */ function microtime_float() { list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec); } $time_start = microtime_float(); //休息一下或程式碼放這裡 usleep(100); $time_end = microtime_float(); $time = $time_end - $time_start; echo "執行時間".$time.'秒<br />';