PHP – Use output buffering

Output buffering is a simple way to greatly improve the performance and speed of your PHP script. Without output buffering, your script will show the HTML on the page as it’s processed – in pieces. Adding output buffering allows the PHP to store the HTML as a variable and send it to the browser in one chunk.

To enable output buffering, simply add ob_start ( ) like so at the top of the file right after the DOCTYPE like the following:
<?php ob_start ( ‘ ob_gzhandler ‘ ) ; ?>

Tags: , , ,

Posted on Wednesday, March 3rd, 2010 at 4:52 pm.
Diary, Theory & Concept, Web Authoring.

Leave a comment