
- PHP 7 Tutorial
- PHP 7 - Home
- PHP 7 - Introduction
- PHP 7 - Performance
- PHP 7 - Environment Setup
- PHP 7 - Scalar Type Declarations
- PHP 7 - Return Type Declarations
- PHP 7 - Null Coalescing Operator
- PHP 7 - Spaceship Operator
- PHP 7 - Constant Arrays
- PHP 7 - Anonymous Classes
- PHP 7 - Closure::call()
- PHP 7 - Filtered unserialize()
- PHP 7 - IntlChar
- PHP 7 - CSPRNG
- PHP 7 - Expectations
- PHP 7 - use Statement
- PHP 7 - Error Handling
- PHP 7 - Integer Division
- PHP 7 - Session Options
- PHP 7 - Deprecated Features
- PHP 7 - Removed Extensions & SAPIs
- PHP 7 Useful Resources
- PHP 7 - Quick Guide
- PHP 7 - Useful Resources
- PHP 7 - Discussion
PHP – Get or set the HTTP output character encoding with mb_http_output()
The mb_http_output() function in PHP is used to get or set the HTTP output character encoding. An output, after this function is called, will be converted from the set internal encoding to the specified encoding.
Syntax
string|bool mb_http_output(str $encoding = null)
Parameters
mb_http_output() accepts only a single parameter −
$encoding − It is used to set the HTTP output character encoding to the encoding. If the encoding is omitted, then mb_http_output() will return the current HTTP output character encoding.
Return Values
If the encoding is omitted, then the mb_http_output() function will return the current HTTP output character encoding. Otherwise, it returns True on success and False on failure.
Example
<?php // It will return the output character encoding $string = mb_http_output(); var_dump($string); ?>
Output
It will produce the following output −
string(5) "UTF-8"
- Related Articles
- PHP – Detect HTTP input character encoding with mb_http_input()
- PHP http://
- PHP HTTP context options
- How to get the value associated with the http-equiv or name attribute in HTML?
- PHP – How to set the character encoding detection order using mb_detect_order()?
- How to use an HTTP GET or POST for Ajax Calls?
- Can we get the HTTP Response Code in Selenium with Java?
- How to change the Output Encoding Scheme of the C# Console?
- PHP – Set the current setting for character encoding conversion using iconv_set_encoding() function
- What is PHP Output Buffering?
- HTTP Requests with axios in ReactJS
- What is HTTP?
- How to return the protocol (http or https) of the web page with JavaScript?
- HTTP basic authentication URL with “@” in password.
- How to get HTTP Response Code using Selenium WebDriver?

Advertisements