ob_start
Turn on output buffering
ob_start()
function creates an output buffer. A callback function can be passed in to process the content of the buffer and operate on it before it is refreshed. Flags can also be used to allow or limit what the buffer can do.
Create an output buffer:
<?php ob_start ( ) ; echo "This content will not be sent to the browser." ; ob_end_clean ( ) ; echo "This content will be sent to the browser." ; ?>
Try it yourself
ob_start ( callback , chunk_size , flags ) ;
parameter | describe | ||||||
---|---|---|---|---|---|---|---|
callback |
Elective. A callback function for processing content before the buffer content is flushed. The callback function should have the following parameters:
|
||||||
chunk_size | Elective. The default is 0. When set to a value greater than zero, the buffer will automatically refresh once the content length exceeds this value. | ||||||
flags |
Elective. The default is PHP_OUTPUT_HANDLER_STDFLAGS. A bitmask that determines what operations the buffer is allowed to perform. It can contain the following flags:
|