tags:

views:

101

answers:

3

Is there a better way to profile code then:

$start1 = microtime(TRUE);
for($i=0;$i<count($array);$i++)
 {
    //do something
 }
$time1 = microtime(TRUE) - $start1;
+1  A: 

try this: http://www.xdebug.org/docs/profiler

cruizer
+1  A: 

Xdebug or Zend Debugger if you have some difficulty to install Xdebug.

Their profiler will time everything for you without any modification of your code.

http://www.xdebug.org/

http://www.zend.com/en/community/pdt

http://devzone.zend.com/article/2899-Profiling-PHP-Applications-With-xdebug - a serie of tutorials about xdebug.

Dinoboff
A: 

Without using an external tool, I would say you've done the best you can.

If you want to use a tool built for the purpose, the other answers are dead-on.

warren