我看到每个人都建议使用一个变量,例如
$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);
?>
至尊宝的传说