Time taken by a PHP script

On many sites you must have noticed a message at the bootom of the page which looks something like "This page was created in 0.2365 seconds".

PHP Code
At the top of the PHP script put the following piece of code.

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

And put the following code at the bottom and you are done.

<?php
   $mtime 
microtime();
   $mtime explode(" ",$mtime);
   $mtime $mtime[1] + $mtime[0];
   $endtime $mtime;
   $totaltime = ($endtime $starttime);
   echo "This page was created in ".$totaltime." seconds";
?>





This article comes from osforge.com
http://www.osforge.com

The URL for this story is:
http://www.osforge.com/viewtutorial67.html