mb_output_handler()
mb_output_handler() — Callback function converts character encoding in output buffer.
Built-in function of PHP 8.5. The manual lists it as available in PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.
What it does
mb_output_handler() is ob_start() callback function. mb_output_handler() converts characters in the output buffer from internal character encoding to HTTP output character encoding.
Signature
mb_output_handler(string $string, int $status): string
Parameters
| Parameter | Type | What it takes |
|---|---|---|
| $string | string | The contents of the output buffer. |
| $status | int | The status of the output buffer. |
Return value
The converted string.
Example
A runnable snippet:
mb_http_output("UTF-8"); ob_start("mb_output_handler");
See also
All PHP 8.5 built-in functions
Reference card built from the PHP manual page mb_output_handler() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.