[UPHPU] Using php to get page load time

Sean sean at lookin3d.com
Tue Apr 8 15:42:46 MDT 2008


Wade Preston Shearer wrote:
>> Is it possible to use PHP to get the time, say in milliseconds, when 
>> a page
>> was loaded? And how would one accomplish that?
>
> If you call microtime() at the bottom of your page, you will get the 
> amount it time it took for it to execute. You can use number_format() 
> to format it the way you want.
You will need to call microtime() at the beginning and end then subtract

$startTime = microtime(true);

doSomething():

$executionTime = microtime(true) - $startTime;

echo "Page Generated In $executionTime Seconds";

-- 

Sean Thayne,
Exit12



More information about the UPHPU mailing list