[UPHPU] Using php to get page load time
Ben Reece
breece at doba.com
Wed Apr 9 09:00:48 MDT 2008
> 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";
Just for clarification -- this doesn't give you an accurate time of how
long it takes for your server to handle a given request, only the
execution time. Since PHP, as a script language, has a lot of overhead,
the actual execution of the script is only part of it. That's not even
getting into the web server piece, or the client side.
Anyway, the original request was for 'load time', not 'execution time',
so I figured I'd mention it.
Ben
More information about the UPHPU
mailing list