- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- 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" }
Advertisements
To Continue Learning Please Login
Login with Google