Further to my previous question, what\'s the best approach when I want to buffer PHP output until I have performed all processing? I want to buffer to leave myself the optio
I open a buffer with ob_start();
( http://php.net/manual/en/function.ob-start.php )
Then anything that would normally be sent to the browser (except headers) is stored in the buffer until I close it. When I want to output or manipulate the buffer, I access it like this:
$buffer = ob_get_clean();
( http://php.net/manual/en/function.ob-get-clean.php )
There are lots of other buffer options here:
http://www.php.net/manual/en/ref.outcontrol.php
This is the best way in my opinion because you don't have to keep adding items to the buffer; PHP is automatically capturing everything as long as the buffer is open.