php: storing a really long var then echoing it, or echoing without putting as var

Joined
12 Feb 2006
Posts
17,627
Location
Surrey
is there any difference speed wise if i was to do a while loop and storing a load of text and styling as one variable and then echoing that out at the end, or just echoing out the while loop as i go?
 
I'd imagine echoing the var each time is more cpu intensive (well only a little bit), whereas storing it each time is more memory intensive.

I'd be more inclined to echo it out each time, at least then you know where you're up to if any problems arise.
 
I doubt there's much difference speed wise. You could always make a script to determine the execution time of your loop with the two differences you specified.
 
Back
Top Bottom