Home » Posts » PHP Timing Script With Average Time

#

PHP Timing Script With Average Time

May 22, 2007

I needed a script that would time some php I wrote to see if using an output buffer would speed it up. I used the php microtime() function to accomplish the timing feature, and combined that with sessions to capture an average execution time. This is the result:



{$ts}s
"; print "Average execution time: {$ea}s ({$_SESSION['avg_count']} attempts)
"; print "Clear Session " ?>

As a general rule, using the output buffer can greatly increase the execution speed of php programs.