mb_http_input()

mb_http_input() — Detect HTTP input character encoding.

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.

Signature

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

Parameters

ParameterTypeWhat it takes
$type?stringInput string specifies the input type. "G" for GET, "P" for POST, "C" for COOKIE, "S" for string, "L" for list, and "I" for the whole list (will return array). If type is omitted, it returns the last input type processed.

Return value

The character encoding name, as per the type, or an array of character encoding names, if type is "I". If mb_http_input() does not process specified HTTP input, it returns false.

Example

The PHP manual ships no example for mb_http_input(); the signature and the parameter table above are the contract.

Changelog

VersionChange
8.0.0mb_http_input() now throws a ValueError if type is invalid. type is nullable now.

See also

mb_internal_encoding(), mb_http_output(), mb_detect_order()

All PHP 8.5 built-in functions

Reference card built from the PHP manual page mb_http_input() (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.