Re: General Coding Question

From: Date: Wed, 20 Jun 2001 19:05:52 +0000
Subject: Re: General Coding Question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-54588@lists.php.net to get a copy of this message
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 lee@mediawaveonline.com ""James Stevens"" <jstevens@endeavors.com> wrote in message news:PIEKLBHBFGIJJOLMIOCGAEOIDJAA.jstevens@endeavors.com... > 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: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#54588) next »