O'Reilly logo

Core PHP Programming: Using PHP to Build Dynamic Web Sites by Leon Atkinson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Output Buffering

As stated above, the Web server buffers content sent to the browser, and you can request that the buffer be flushed. PHP4 introduced a new mechanism for buffering output you can control completely. Four functions control PHP's output buffer: ob_start, ob_end_flush, ob_end_clean, and ob_ get_contents. These are described in detail in Chapter 8, complete with examples, but I would like to give an overview here.

When you call the ob_start function, anything you send to the browser is placed into a buffer. This includes text outside of PHP tags. The Web server will not receive this content until the ob_end_flush function is called. There are several powerful applications of these functions. One is to avoid the problem associated ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required