Fatal error: Call to undefined function: floatval() in
/home/dae51d/public_html/examples/echotest.php on line 14 

> -----Original Message-----
> From: Chris Shiflett [mailto:[EMAIL PROTECTED]] 
> Sent: Thursday, February 06, 2003 2:40 PM
> To: anders thoresson; [EMAIL PROTECTED]
> Subject: Re: [PHP] jumping between php and html or using echo 
> for printing html-tags.
> 
> 
> --- anders thoresson <[EMAIL PROTECTED]> wrote:
> > Which is more efficient:
> 
> Your first method is more efficient according to my quick
> test, though I find myself preferring the second when I
> write code due to the readability advantages. The
> difference is small, however. Here is the code I used to
> test, so you can try it out (and verify my method of
> testing) for yourself:
> 
> <?
> $foo = 'bar';
> 
> # TIME FIRST METHOD
> list($microseconds, $seconds) = explode(' ', microtime());
> $start_time = floatval($seconds) + floatval($microseconds);
> for ($i = 0; $i < 100; $i++)
> {
>      echo "a href=\"" . $_SERVER['PHP_SELF'] . "?action=" .
> $foo . "\">\n";
> }
> list($microseconds, $seconds) = explode(' ', microtime());
> $end_time = floatval($seconds) + floatval($microseconds);
> $total_time_first = $end_time - $start_time;
> 
> # TIME SECOND METHOD
> list($microseconds, $seconds) = explode(' ', microtime());
> $start_time = floatval($seconds) + floatval($microseconds);
> for ($i = 0; $i < 100; $i++)
> {
> ?>
> <a href="<? echo $_SERVER['PHP_SELF']; ?>?action=<? echo
> $foo; ?>">
> <?
> }
> list($microseconds, $seconds) = explode(' ', microtime());
> $end_time = floatval($seconds) + floatval($microseconds);
> $total_time_second = $end_time - $start_time;
> 
> # OUTPUT RESULTS
> echo "<p>First method took  " . $total_time_first . "
> seconds</p>\n";
> echo "<p>Second method took " . $total_time_second . "
> seconds</p>\n";
> ?>
> 
> Chris
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


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

Reply via email to