Miscellaneous

  Home arrow Miscellaneous arrow PHP Output Buffering
MISCELLANEOUS

PHP Output Buffering
By: Codewalkers
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 20
    2003-06-10

    Table of Contents:
  • PHP Output Buffering
  • How It's Done
  • Callback Functions
  • Examples
  • Conclusion

  •  
     

    SEARCH CODEWALKERS

    PHP Output Buffering


    (Page 1 of 5 )

    This tutorial will procede first by enumerating the functions used in output buffering with a brief explanation of each. Then we will examine how these functions are utililized. We will conclude with three brief examples of scenerios where one might use output buffering.

    By : Michael Bailey

    Today I want to answer a question which has vexed mankind for centuries, "How do I get my suit dry-cleaned without that disgusting chemical smell? And can I get it done overnight?" Unfortunately, I don't have the slightest idea how to answer that question, so I'm forced instead to discuss output buffering in PHP. That's how life is some times.

    Output buffering is a powerful tool in PHP which allows you to buffer a script's output. You can then edit this buffer before returning it to the client.

    This tutorial will procede first by enumerating the functions used in output buffering with a brief explanation of each. Then we will examine how these functions are utililized. We will conclude with three brief examples of scenerios where one might use output buffering. Without further ado then, we will procede to...

    Output Buffering Functions

    Our toolbox of functions dealing with output buffering is fairly small. The following are the most common functions. The full list can be obtained from the PHP website.

    ob_start([callback function]) - Starts an output buffering session.
    ob_flush() - Send the contents of the buffer to the client 
                 and clear the buffer.
    ob_get_contents() - Returns the contents of the buffer. 
                        The buffer is not cleared.
    ob_end_clean() - Ends the current buffering session and 
                     purges the buffer.
    ob_end_flush() - Ends the current buffering session and 
                     displays the buffer.
    ob_get_length() - (Version >= 4.0.2) Return the size of the 
                      current buffer.
    ob_get_clean() - (Version >= 4.3) Composite of ob_get_contents()
                     and ob_end_clean(). The buffer is returned and 
                     the session ends.

    More Miscellaneous Articles
    More By Codewalkers

    blog comments powered by Disqus

    MISCELLANEOUS ARTICLES

    - Attention: Forum and Site Maintenance
    - Oracle Database XE: Indexes and Sequences
    - Modifying Tables in Oracle Database XE
    - Oracle Database XE: Tables and Constraints
    - More on Oracle Databases and Datatypes
    - Oracle Database XE Datatypes: Datetime and L...
    - Oracle Database XE Datatypes: Character and ...
    - From Databases to Datatypes
    - Firefox 3.6.6 Released with Improved Plug-in...
    - Attention Bloggers: WordPress 3.0 Now Releas...
    - Reflection in PHP 5
    - Inheritance and Other Advanced OOP Features
    - Advanced OOP Features
    - Linux from Scratch V.6.6 Review
    - Linux Gaining in Strength

    Developer Shed Affiliates

     



    © 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap