This is a code snippet on how to get the execution time of a PHP script.
This is the first from the code snippet series.
<?php
function GetMicroTime()
{
list($microseconds, $seconds) = explode(" ", microtime());
return ((float)$microseconds + (float)$seconds);
}
//read the time at the beggining of the php file
$nStartTime = GetMicroTime();
/* Your code goes here
...
*/
//read the time at the end of the php file
$nEndTime = GetMicroTime();
$szGeneratedTime = "Page generated in " .
number_format(($nEndTime - $nStartTime), 4) .
" seconds.";
echo $szGeneratedTime;
?>













