5

次のような変数を使用することを誰もが提案しています

$start_time = microtime(TRUE);

スクリプトの上に追加し、最終行で次のようにします。

$process_time = microtime(TRUE) - $start_time;

$_SERVER['REQUEST_TIME_FLOAT']私の質問は、 $start_time を完全に確実に使用してスキップできるかということです。もしそうなら、なぜ誰もが $start_time を上に使用することを提案しているのでしょうか?

私が意味するものの例:

<?php
// No need for $start_time...

// All the stuff we do to have the benchmark at the end

// Only this line needed to display execution time
echo "Processed in: ". bcsub(microtime(TRUE), "{$_SERVER['REQUEST_TIME_FLOAT']}", 4);
?>
4

1 に答える 1