Output Handlers
Output handlers are callables associated with output buffers
that are invoked by calling ob_clean,
ob_flush, ob_end_flush,
ob_get_flush, ob_end_clean,
ob_get_clean or during PHP's shutdown process.
Note:
The shutdown process will flush the return value of the handler.
If omitted or null
when starting the output buffer
the internal "default output handler"
will be used
which returns the unmodified contents of the buffer when invoked.
Output handlers can be used to return a modified version
of the buffer's contents and/or have side-effects (e.g. send headers).
PHP comes with two internal output handlers:
"default output handler"
and "URL-Rewriter"
(which is integrated into
its own output buffer and only up to two instances of it can be started).
The bundled extensions include four additional output handlers:
mb_output_handler, ob_gzhandler,
ob_iconv_handler, ob_tidyhandler.