CascadiaPHP 2024

Operations Allowed On Buffers

The operations allowed on buffers can be controlled by passing one of the buffer control flags to ob_start()'s third flags parameter. If omitted, all operations are allowed by default. If 0 is used instead, the buffer cannot be flushed, cleaned or removed but it's contents can still be retrieved.

PHP_OUTPUT_HANDLER_CLEANABLE allows ob_clean() to clean the contents of the buffer.


The absence of the PHP_OUTPUT_HANDLER_CLEANABLE flag will not prevent ob_end_clean() or ob_get_clean() from clearing the contents of the buffer.

PHP_OUTPUT_HANDLER_FLUSHABLE allows ob_flush() to flush the contents of the buffer.


The absence of the PHP_OUTPUT_HANDLER_FLUSHABLE flag will not prevent ob_end_flush() or ob_get_flush() from flushing the contents of the buffer.

PHP_OUTPUT_HANDLER_REMOVABLE allows ob_end_clean(), ob_end_flush(), ob_get_clean() or ob_get_flush() to turn off the buffer.

PHP_OUTPUT_HANDLER_STDFLAGS, the combination of the three flags will allow each of the three operations to be performed on the buffer.

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top