DEVTRENCH.COM

PHP Timing Script With Average Time

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:


[[PHP code to test here]]
{$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.