Skip to Content
PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide
book

PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide

by Larry Ullman
May 2003
Intermediate to advanced
592 pages
14h 28m
English
Peachpit Press
Content preview from PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide

Output Buffering

An interesting new feature in version 4 of PHP is output control. Output control (or output buffering) allows you to write and execute your scripts as normal but send data to the Web browser only at select points. The main benefit of this system is that you can call the header(), setcookie(), and session_start() functions at nearly any spot in your script without concern for the headers already sent error messages.

To begin output buffering, use the ob_start() function. Once you call it, every echo(), print(), and similar function will send data to a memory buffer rather than the Web browser. Conversely, HTTP calls (like header() and setcookie()) will not be buffered and will operate as usual.

At the conclusion of the script, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

PHP and MySQL for Dynamic Web Sites: Visual Quickpro Guide, Second Edition

PHP and MySQL for Dynamic Web Sites: Visual Quickpro Guide, Second Edition

Larry Ullman

Publisher Resources

ISBN: 0321186486Purchase book