Start and stop a timer PHP

前端 未结 8 796
北海茫月
北海茫月 2020-11-30 08:08

I need some information regarding starting and stopping a timer in PHP. I need to measure the elapsed time from the start of my .exe program (I\'m using exec()

8条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-30 08:49

    You can use microtime and calculate the difference:

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

    Here's the PHP docs for microtime: http://php.net/manual/en/function.microtime.php

提交回复
热议问题