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:
2. Add the following code at the end of the .php file:
After this code is installed you may see something like this:
Page loaded in 0.65 seconds.
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.