RE: Interesting problem - PHP 4.3, IIS5, ISAPI

From: Date: Sat, 15 Feb 2003 05:46:33 +0000
Subject: RE: Interesting problem - PHP 4.3, IIS5, ISAPI
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-18544@lists.php.net to get a copy of this message
call the stoptiming() function before </HTML> tag, browser may ignore any text after </HTML> tag. <? function startTiming() { global $startTime; $microtime = microtime(); $microsecs = substr($microtime, 2, 8); $secs = substr($microtime, 11); $startTime = "$secs.$microsecs"; } 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."; } 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>"; } stopTiming(); ?> </BODY> </HTML> regds, -----Original Message----- From: Matt Babineau [mailto:matt@criticalcode.com] Sent: Saturday, February 15, 2003 01:18 To: php-windows@lists.php.net Subject: Interesting problem - PHP 4.3, IIS5, ISAPI 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(); ?>

« previous php.windows (#18544) next »