php output buffering

sample code only, please try it yourself to see the result.

<?php
ob_start();
print "In first buffer!\n";
ob_end_flush();
ob_start();
print "In second buffer!\n";
ob_end_clean();
ob_start();
print "In third buffer!\n";

?>

<?

ob_start();
phpinfo();
$info = ob_get_contents();
ob_end_clean();
echo $info; /* papar semua content sekaligus */

?>

ref: http://www.linuxformat.co.uk/wiki/index.php/PHP_-_Output_buffering

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s