| Making It Simpler |
In case you're wondering, it isn't really necessary for you to call ob_start() and ob_end_flush() at the beginning and end of every script if you don't want to. Once you make the decision to use output buffering in your scripts, you'll find it quite annoying to include two extra lines of code at the top and bottom of each and every script in your application.
Well, there's a simple solution - you can have PHP automatically transfer all script output to an output buffer by explicitly switching buffering on for *all* scripts , either via a configuration directive in the "php.ini" configuration file, or via a call to ini_set().
output_buffering = On
This is sometimes referred to as implicit buffering, since it's handled automatically by the PHP engine.
If you'd like to restrict the output buffer to a specific size, you can do so by specifying the size as a numeric value to the configuration drirective above.
It's important to keep in mind, though, that while implicit buffering is a fairly cool thing, there are a couple of caveats which come with it. First, implicit output buffering adds to the work PHP has to do when processing a script, which could end up degrading performance. Second, since all the output of the script is stored in a separate buffer, debugging script errors becomes far more complicated.
How to do Everything with PHP & MySQL
How to do Everything with PHP & MySQL, the best-selling book by Melonfire, explains how to take full advantage of PHP's built-in support for MySQL and link the results of database queries to Web pages. You'll get full details on PHP programming and MySQL database development, and then you'll learn to use these two cutting-edge technologies together. Easy-to-follow sample applications include a PHP online shopping cart, a MySQL order tracking system, and a PHP/MySQL news publishing system.
Read more, or grab your copy now!