Php 如何知道特定函数的运行时间?
我正在使用PHP和Zend。我的一些代码执行时间太长。了解特定函数/构造函数消耗了多少时间的最佳方法是什么 例如: 我调用的函数如下:Php 如何知道特定函数的运行时间?,php,zend-framework,function,runtime,Php,Zend Framework,Function,Runtime,我正在使用PHP和Zend。我的一些代码执行时间太长。了解特定函数/构造函数消耗了多少时间的最佳方法是什么 例如: 我调用的函数如下: $insuranceModel = new Model_Insurance_Object(); $insurances = $insuranceModel->getInsurancesList(); 模型\保险\对象类中的getInsurancesList函数 我应该实施什么?我应该放在哪里 谢谢我有一份工作。看来,这正是你想要的。@KingChurch
$insuranceModel = new Model_Insurance_Object();
$insurances = $insuranceModel->getInsurancesList();
模型\保险\对象类中的getInsurancesList函数
我应该实施什么?我应该放在哪里
谢谢我有一份工作。看来,这正是你想要的。@KingChurch回答得很好!:D如果您不想使用.dll安装路径,还可以编写一个小benchit,它可以乘以任何代码段的运行时间
function benchit()
{
list($msec, $sec) = explode(' ', microtime());
return (double)$sec + (double)$msec;
}
$start = benchit();
// ... Some code here
$end = benchit();
也很有用,可能是
function benchit()
{
list($msec, $sec) = explode(' ', microtime());
return (double)$sec + (double)$msec;
}
$start = benchit();
// ... Some code here
$end = benchit();