8.4. Output Buffering
The output buffering commands add a layer of buffering controlled by PHP in addition to whatever buffering the Web server uses. Some performance penalty may be incurred by adding another layer of buffering, but you may decide the greater control you have is worth the price.
When ob_start is called, all output by functions such as print and echo is held back in a buffer, a large area of memory. The contents of the buffer may be sent to the browser using ob_end_flush, or it may be thrown away using ob_end_clean. As you recall from Chapter 7, headers cannot be sent after the first content is sent. Therefore, these functions allow you to avoid errors created by sending headers after content.
ob_clean()
This function erases the ...
Get Core PHP Programming, Third Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.