有没有更好的方法来分析代码:
$start1 = microtime(TRUE);
for($i=0;$i<count($array);$i++)
{
//do something
}
$time1 = microtime(TRUE) - $start1;
答案 0 :(得分:2)
如果您在安装Xdebug时遇到一些困难,请使用Xdebug或Zend Debugger。
他们的探查器会为您准备好一切,而无需修改您的代码。
http://www.zend.com/en/community/pdt
http://devzone.zend.com/article/2899-Profiling-PHP-Applications-With-xdebug - 一系列关于xdebug的教程。
答案 1 :(得分:0)
如果不使用外部工具,我会说你已经做到了最好。
如果您想使用为此目的而构建的工具,其他答案都是无效的。