PHP Page Load Time Function

 

The following script will give you a load time function script, which calculates the amount of time a page, has taken to load.

 

Example

Page loaded in 0.000030 seconds!

 

Script Source

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

$mtime = microtime();
$mtime = explode (" ", $mtime);
$mtime = $mtime[1] + $mtime[0];
$tend = $mtime;
$totaltime = ($tend - $tstart);
printf ("Page loaded in %f seconds!", $totaltime);
?>

Please let me know if this script was helpful to you.

[rating]