タイマーの開始と停止 PHP 質問する

タイマーの開始と停止 PHP 質問する

PHP でタイマーを開始および停止する方法に関する情報が必要です。.exe プログラム ( exec()PHP スクリプトで関数を使用) の開始から実行が完了するまでの経過時間を計測し、かかった時間を秒単位で表示する必要があります。

これどうやってするの?

ベストアンサー1

microtime差を計算するには次のようにします。

$time_pre = microtime(true);
exec(...);
$time_post = microtime(true);
$exec_time = $time_post - $time_pre;

以下は PHP ドキュメントですmicrotime:http://php.net/manual/en/function.microtime.php

おすすめ記事