this whole bench thing really needs someone to sit down and go "i bet i
could write some code to see in less time then it would take to post ?" dont
get mad, people are allways posting this.

" is this aster then that ? "

write some code and see. its very hardware/os dependant. your system may be
very diff then someone else. more likley then not.

<?php

 function debug_time()
 {
  $debug_time = microtime();
  $debug_time = str_replace('.', '', $debug_time);
  $debug_time = explode(' ', $debug_time);
  $debug_time = $debug_time[1] . $debug_time[0];

  return($debug_time);
 }

  class debug
  {

  function debug()
  {
   $this->start = debug_time();
  }

  function reset()
  {
   $all_vars = get_object_vars($this);
   foreach($all_vars as $pos => $val)
    if ($pos != 'error')
     unset($this->$pos);
  }

  function time($text = '')
  {
   $this->break = debug_time();
   $time = ($this->break - $this->start) / 1000000000;

   error_log(number_format($time, 4) ." : $text \n", 3,
'/var/log/php_err.log');

   $this->start = $this->break;
  }
  }

  $debug = new debug;

 $debug->time('a');
 for($c = 0; $c < 100000; $c++)
   echo "test";
 $debug->time('b');
 for($c = 0; $c < 100000; $c++)
   ?>test<?php
 $debug->time('a');

?>

0.0002 : a
2.0003 : b
1.9478 : a

therefore on *my* system it is very very slightly faster to exit out of php
and echo. i find it ugly. imho.

--

  Chris Lee
  [EMAIL PROTECTED]



""James Stevens"" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Does it have any effect on performance in either case if a file is
> completely done in PHP(1) or interspersed with PHP(2).
>
> (1)
> <?php
> echo "<html>";
> ...
> ?>
>
> (2)
> <html>
> ...
> <?php echo $forminput; ?>
> ...
>
> Also, and this is personal preference, which is easier to read/debug?
>
> James
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to