communication
 databases
 directories
 file handling
 html and code
 image editing
 image listing
 sessions and co
 string handling
 information
 forms
 apple stuff
 image handling
 array handling
 lixlpixel
php - snippets
google search terms detected and highlighted.
remove highlighting | keep highlighting
make snippet in "information" - download "loading time" - open demo of "loading time"
 search
php - snippets

Valid CSS!

php webring logo
prev next
random list
join the Ring!

information - loading time was created/last modified on Mon 22 Mar 2004 8:07 AM

Shows the loading time of a page.
   
  <?
  
function getmicrotime(){
  list(
$usec, $sec) = explode(" ",microtime());
  return ((float)
$usec + (float)$sec);
  }
  
$time_start = getmicrotime();

  
// start page content
  // this is dummy - content
for ($i=0; $i <1000; $i++){
  }
  
// end page content
  
  
$time_end = getmicrotime();
  
$time = $time_end - $time_start;
  
$time = round($time,6);
  echo
"This page loaded in $time seconds.";
  
?>

learn more about some of the PHP functions used in this snippet: echo, end, explode, for, function, list, microtime, return, round, time

view the GNU general license - view the GNU library license - search on PHPsnippets - see your code like this

 a lixlpixel.com site

go to PHParadise to get free PHP, Javascript and FlashMX code