Code to display the load time of your website

by Sanju 2012-06-20 19:32:40

Code to display the load time of your website

You need to know how long your site takes to load. Use this script to find out if your site is taking too long, and if it is, fix it.

Insert this code snippet inside the and tags of your document:

$starttime = microtime();
$startarray = explode(" ", $starttime);
$starttime = $startarray[1] + $startarray[0];


Insert this code snippet directly before the closing tag of your document:

$endtime = microtime();
$endarray = explode(" ", $endtime);
$endtime = $endarray[1] + $endarray[0];
$totaltime = $endtime - $starttime;
$totaltime = round($totaltime,10);
echo "Seconds To Load: ";
printf ("%f\n", $totaltime);
1672
like
0
dislike
0
mail
flag

You must LOGIN to add comments