Saturday, November 28, 2009


We sometimes see that page loading time is mentioned at the bottom. For example, "Page loaded in x.xx seconds." Below is the method for showing that in your php pages.

1. Add the following code at the top of the .php file:

function utime (){
$time = explode( " ", microtime());
$usec = (double)$time[0];
$sec = (double)$time[1];
return $sec + $usec;
}
$start = utime();
?>

2. Add the following code at the end of the .php file:

$end = utime(); $run = $end - $start; echo "Page loaded in " . substr($run, 0, 5) . " seconds.";
?>

After this code is installed you may see something like this:
Page loaded in 0.65 seconds.

Be Informed Whenever a New Post is Published.

If you enjoyed this article, SUBSCRIBE now for FREE to get regular updates delivered to your E-mail inbox.Your E-mail is safe with us - No spam, we promise.

0 comments:

Post a Comment

Follow Us

Blog Archive

Popular Posts