跳到主要內容

計算程式運算時間 – PHP版

前面有寫到用Java寫一個計算程式運算時間,這次我們用PHP的版本
<?php
function getMicroTime(){  
    list($usec, $sec) = explode(' ', microtime()); 
    return ((double)$usec + (double)$sec); 
}
//開始的時間 
$start_time = getMicroTime(); 
//要計算時間的程式 
doSomeThing(); 
//結束的時間 
$end_time = getMicroTime(); 
echo $end_time - $start_time;
?>

留言

這個網誌中的熱門文章

What is phpize

What is phpize According to the PHP official document : The phpize command is used to prepare the build environment for a PHP extension. If you need to build such an extension that from github or another code repositories, you can use  build tools to perform the build manually.