I am trying to output the page runtime to omake a comparison between php
and Coldfusion. I have 2 functions one to start a timer, one to end a
timer.

The php code block in the middle between reads a 140mb file and does
some other stuff. This is fairly unimportant at this point. With the
code block in between the timer functions present, the timer functions
don't output the processing time. When I remove the code block, the
timer functions work great...I don't get it!!

Help!

CODE:
--------------------------
<?
function startTiming() {
  global $startTime;
  $microtime = microtime();
  $microsecs = substr($microtime, 2, 8);
  $secs = substr($microtime, 11);
  $startTime = "$secs.$microsecs";
}
startTiming();
?>


<HTML>
<HEAD>
<TITLE>Stats Server</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
</HEAD>

<BODY>
<?

$fp = fopen("d:\www\ex030124.log", "r");
$i = 0;

while (!feof($fp)) {
        $rowData = fgets($fd);
        /*
        if(substr($rowData, 1, 1) == "#") {
                $iisTitle = preg_split(":", $rowData, "1");
                echo $iisTitle . "<BR>";
        }
        */
        $i++;
        //echo $i . "<BR>";
}

?>
</BODY>
</HTML>
<?
function stopTiming() {
  global $startTime;
  $microtime = microtime();
  $microsecs = substr($microtime, 2, 8);
  $secs = substr($microtime, 11);
  $endTime = "$secs.$microsecs";
  echo "<HR>Execution time " . ($endTime - $startTime) . " seconds."; 
        }

stopTiming();
?>


-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to