I could be wrong, but I seem to remember reading somewhere that using ?> text <? is actually just shorthand for echo " text "; as far as the php engine itself is concerned.
Again I'm not positive, but if this is the case it would coincide with the comment made earlier that they are in fact the same speed, but that outputting a large amount of text through a single ?> <? would be slightly faster than using numerous echo commands. At 06:39 PM 7/9/2002 -0500, Chris Shiflett wrote: >Peter Thoenen wrote: > >>Question on optimizing code for quicker runtimes. Which is quicker (this >>is on a webpage also..NOT >>commandline)? >> >><?php if ($a){ echo 'abc'; } ?> >> >>OR >> >><?php if ($a) { ?> abc <?php } ?> > >Because the difference is going to be undetectable, this would probably be >a question that only someone really familiar with the engine would be able >to answer with any sort of assurance. > >My bet is that the second method is faster in theory, because switching >in/out of PHP is likely marginally faster than executing the echo >function. Maybe if you create some scripts that loop through these >statements 10,000 times each and measure the time with microtime(), you >can get a more affirmative answer and let the list know your results. > >Happy hacking. > >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