Show Page Load Time In PHP
Using a line of code at the beginning of the file and a function call at the end, you can count the number of milliseconds it took PHP to load the page.
|
On Wednesday, October 1st 2008 at 06:02 PM By Andrew Pociu (View Profile)
    (Rated 0 with 0 votes) |
Contextual Ads
More PHP Resources
Advertisement
function PerfStopCount()
{
$TimeElapsed = round($EndAt - $StartAt, 4);
echo "Loaded in ". $TimeElapsed. " milliseconds";
}
// The PHP code for the page has to go here (in the middle)
// Sample time consuming code
for($i = 0; $i < 100000; $i++)
{
$i ^ 2;
}
// End sample
PerfStopCount();
|
Digg It!
Del.icio.us
Reddit
StumbleIt
Newsvine
Furl
BlinkList
|
|
Rate this code snippet
Current Comments
|
Related Source Code
There is no related code.
Related Tutorials
There are no related tutorials.
PHP Job Search
|