PHP 8.4.1 Released!

Flags Passed To Output Handlers

The bitmask passed to the second phase parameter of the output handler provides information on the invocation of the handler.

Bilginize: The bitmask can include more than one flag and the bitwise & operator should be used to check whether a flag is set.

Uyarı

The value of PHP_OUTPUT_HANDLER_WRITE and its alias PHP_OUTPUT_HANDLER_CONT is 0 therefore whether it is set can only be determined by using an equality operator (== or ===).

The following flags are set in a specific phase of the handler's lifecycle: PHP_OUTPUT_HANDLER_START is set when a handler is invoked for the first time. PHP_OUTPUT_HANDLER_FINAL or its alias PHP_OUTPUT_HANDLER_END is set when a handler is invoked for the last time, i.e. it is being turned off. This flag is also set when buffers are being turned off by PHP's shutdown process.

The following flags are set by a specific invocation of the handler: PHP_OUTPUT_HANDLER_FLUSH is set when the handler is invoked by calling ob_flush(). PHP_OUTPUT_HANDLER_WRITE or its alias PHP_OUTPUT_HANDLER_CONT is set when the size of its contents equals or exceeds the size of the buffer and the handler is invoked while the buffer is being automatically flushed. PHP_OUTPUT_HANDLER_FLUSH is set when the handler is invoked by calling ob_clean(), ob_end_clean() or ob_get_clean(). When ob_end_clean() or ob_get_clean() is called, PHP_OUTPUT_HANDLER_FINAL is set as well.

Bilginize: When ob_end_flush() or ob_get_flush() is called, PHP_OUTPUT_HANDLER_FINAL is set but PHP_OUTPUT_HANDLER_FLUSH is not.

add a note

User Contributed Notes

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