Jump to Navigation

053 - Output Buffering

To create a new output buffer and start writing to it, call ob_start(). There are two ways to end a buffer:
ob_end_flush() and ob_end_clean(). The former ends the buffer and sends all data to output, and latter
ends the buffer without sending it to output. Every piese of text written while an output buffer isopen is
placed into that buffer, as opposed to being sent output. If you do not want to end the buffer,
you can use ob_flush() and ob_clean.

Exapmle:

ob_start();
print "In first buffer\n";
ob_start();
print "In second buffer\n";
ob_end_flush();
print "In first buffer\n";
ob_end_flush();

 

PHP:


Main menu 2

Story | by Dr. Radut