Originally posted by Dixen
Nah... most of the code that I am referring to have 10-15 lines of straight html code that I am echoing. However, there are a couple of scripts that I end up echoing a single line of code a couple hundred times. Each line contains a couple or 3 variables surrounded by table code, formatting, etc (html). So, I'm wondering if it would be more efficient to do it without echoing the whole line and just echo the variables through the parser.
you can always test it yourself.
go here for an example of how to meaure the speed of parts of your script
http://www.php.net/microtime
you will probably find the difference in speed is very insignificant unless you are outputting a very large amount of text. but jumping in and out of php also takes time. really all you can do is time it yourself so you get a feel for when jumping in and out of php is beneficial.
also keep in mind, if you have output buffering on, everything will change. some php installations even use a default buffer of about 4k. if this is so, then that will also affect your tests, and the size of this default buffer will as well.
to summarize, dont spend much time on this. i would recomend like above, do whatever is most readable and maintainable. the differences in speed will prob be very very small fractions of a second.