- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
PHP – Detect HTTP input character encoding with mb_http_input()
The mb_http_input() function in PHP is used to detect the HTTP (Hyper-text transfer protocols) input character encoding. This function is supported in PHP 5.4 or higher version.
Syntax
array|string mb_http_input(str $type=null)
Parameters
mb_http_input() accepts only a single parameter −
$type − In the type parameter, the input string specifies the input type, like −
G is used for GET,
P is used for POST,
C is used for COOKIE,
S is used for STRING,
L is used for LIST, and
I for the whole list (it will return array).
If the type is omitted, then it returns the last input type processed.
Return Values
mb_http_input() returns the character encoding name as per the type, or an array of character encoding names. If the type is "I" and if the mb_http_input() does not process the specified HTTP input, then it returns False.
Example
<?php // It will return the input character encoding //UTF-8 $string =mb_http_input("I"); var_dump($string); ?>
Output
array(1) { [0]=> string(5) "UTF-8" }
- Related Articles
- PHP – Get or set the HTTP output character encoding with mb_http_output()
- PHP – How to detect character encoding using mb_detect_encoding()
- Detect base64 encoding in PHP?
- PHP – Convert a string to a requested character encoding using iconv()
- PHP – How to set the character encoding detection order using mb_detect_order()?
- PHP http://
- PHP – Set the current setting for character encoding conversion using iconv_set_encoding() function
- Node.js – Retrieving file character encoding
- PHP HTTP context options
- How to detect search engine bots with PHP?
- How to include the character encoding in HTML?
- Encoding string based on character frequency in JavaScript
- What is HTTP Flooding? (Process, Types, How to Detect and Defend)
- Detect the ENTER key in a text input field with JavaScript
- Convert ASCII TO UTF-8 Encoding in PHP?

Advertisements