Tuesday, June 16, 2026
HomeLanguagesPHP mb_http_input() Function

PHP mb_http_input() Function

The mb_http_input() is an inbuilt function in PHP that facilitates the HTTP input character encoding to be detected.

Syntax:

mb_http_input(?string $type = null): array|string|false

Parameter: 

  • type: This parameter takes values like “G” for GET, “P” for POST, “C” for COOKIE, “S” for string, “L” for the list, and “I” for the whole list which will return an array. If the type is missing then it returns the last input type processed.

Return Value: This function will return the character encoding name or an array of character encoding names, depending on the type. It returns “false” if the function does not process specified HTTP input.

Example 1: The following code demonstrates the mb_http_input() function.

PHP




<?php
// Get the character encoding of the HTTP input
$http_input_encoding = mb_http_input('I');
  
// Output the encoding
var_dump( $http_input_encoding);
?>


Output:

array(1) {
       [0]=> string(5) "UTF-8"
}    

Example 2: The following code demonstrates the mb_http_input() function.

PHP




<?php
$http_input_encoding = mb_http_input("G");
   
// Output the encoding
var_dump($http_input_encoding);
?>


Output:

bool(false) 

Reference: https://www.php.net/manual/en/function.mb-http-input.php

RELATED ARTICLES

Most Popular

Dominic
32516 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
6897 POSTS0 COMMENTS
Nicole Veronica
12013 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12109 POSTS0 COMMENTS
Shaida Kate Naidoo
7019 POSTS0 COMMENTS
Ted Musemwa
7262 POSTS0 COMMENTS
Thapelo Manthata
6976 POSTS0 COMMENTS
Umr Jansen
6964 POSTS0 COMMENTS