Jump to content


Photo

Display Load Time?


  • Please log in to reply
2 replies to this topic

#1 Gregg

Gregg
  • Members
  • PipPipPip
  • Advanced Member
  • 61 posts
  • LocationUSA

Posted 09 September 2006 - 12:21 AM

Ok, here is a question i havent figured out in a while.
How do i display the load time of the curent "Page", like:
It Took 4.9 Seconds To Load Results.

I remember doing it years back but i dont want it in js but php. ???

#2 hostfreak

hostfreak
  • Members
  • PipPipPip
  • Advanced Member
  • 581 posts

Posted 09 September 2006 - 12:32 AM

Here is what a quick google search rendered:

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

echo "content etc";

$endtime = microtime();
$endarray = explode(" ", $endtime);
$endtime = $endarray[1] + $endarray[0];
$totaltime = $endtime - $starttime;
$totaltime = round($totaltime,5);
echo "This page loaded in $totaltime seconds.";
?>


#3 Gregg

Gregg
  • Members
  • PipPipPip
  • Advanced Member
  • 61 posts
  • LocationUSA

Posted 09 September 2006 - 01:01 AM

Thanks, worked great.  :D




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users