Predefined Constants

The constants below are always available as part of the PHP core.

Status flags passed to output handler

The following flags are passed to the second (phase) parameter of the output handler set by ob_start() as part of a bitmask:

PHP_OUTPUT_HANDLER_START (int)

Indicates that output buffering has begun.

PHP_OUTPUT_HANDLER_WRITE (int)

Indicates that the output buffer is being flushed, and had data to output.

PHP_OUTPUT_HANDLER_FLUSH (int)

Indicates that the buffer has been flushed.

PHP_OUTPUT_HANDLER_CLEAN (int)

Indicates that the output buffer has been cleaned.

PHP_OUTPUT_HANDLER_FINAL (int)

Indicates that this is the final output buffering operation.

PHP_OUTPUT_HANDLER_CONT (int)

Indicates that the buffer has been flushed, but output buffering will continue.

This is an alias for PHP_OUTPUT_HANDLER_WRITE.

PHP_OUTPUT_HANDLER_END (int)

Indicates that output buffering has ended.

This is an alias for PHP_OUTPUT_HANDLER_FINAL.

Output buffer control flags

The following flags can be passed to the third (flags) parameter of the output handler set by ob_start() as a bitmask:

PHP_OUTPUT_HANDLER_CLEANABLE (int)

Controls whether an output buffer created by ob_start() can be cleaned by ob_clean(). This flag does not control the behaviour of ob_end_clean() or ob_get_clean().

PHP_OUTPUT_HANDLER_FLUSHABLE (int)

Controls whether an output buffer created by ob_start() can be flushed by ob_flush(). This flag does not control the behaviour of ob_end_flush() or ob_get_flush().

PHP_OUTPUT_HANDLER_REMOVABLE (int)

Controls whether an output buffer created by ob_start() can be removed before the end of the script or when calling ob_end_clean(), ob_end_flush(), ob_get_clean() or ob_get_flush().

PHP_OUTPUT_HANDLER_STDFLAGS (int)

The default set of output buffer flags; currently equivalent to PHP_OUTPUT_HANDLER_CLEANABLE | PHP_OUTPUT_HANDLER_FLUSHABLE | PHP_OUTPUT_HANDLER_REMOVABLE.

Output handler status flags

The following flags are part of the flags bitmask returned by ob_get_status():

PHP_OUTPUT_HANDLER_STARTED (int)

Indicates that the output handler was called.

PHP_OUTPUT_HANDLER_DISABLED (int)

Indicates that the output handler is disabled. This flag is set when the output handler returns false or fails while processing the buffer, or it was set prior to calling the output handler.

PHP_OUTPUT_HANDLER_PROCESSED (int)

Indicates that the output handler successfully processed the buffer.

add a note

User Contributed Notes 1 note

up
-1
adilazmy dot com at gmail dot com
2 months ago
While listing php constants, PHP_OUTPUT_HANDLER_PROCESSED is not defined.

Version:
PHP 8.3.6 (cli) (built: Apr 11 2024 20:23:19) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.6, Copyright (c) Zend Technologies
with Zend OPcache v8.3.6, Copyright (c), by Zend Technologies
To Top