由於最近在寫讀取資料庫時,一直在想用先用DB_num_rows取出值然後再用FOR去跑比較快,還是用WHILE去跑比較快,因此寫了一個小程式去跑看看
程式碼如下
function caclutime(){//時間計算FUNCTION $time = explode( " ", microtime()); $usec = (double)$time[0]; $sec = (double)$time[1]; return $sec + $usec; } $sql = "SELECT birth FROM `char_data` where id = '$this->id' ORDER BY job "; echo "$total 秒 while 執行 $t 次:";//顯示結果 |