Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想测量我的 php 脚本的指定部分需要多长时间,例如
$startTime = microtime(true); //some operations which needs 0.1 to 100 seconds to run $endTime = microtime(true);
如何将持续时间(以微秒为单位)作为整数?
这不起作用:
$duration = (int)($endTime - $startTime);
如果您希望将微秒作为整数:
$duration = round(($endTime - $startTime) * 1000000)