PHP – Get the internal settings of mbstring with mb_get_info()

PHPServer Side ProgrammingProgramming

The mb_get_info() function in PHP is used to get the internal settings of mbstring. This function is supported in PHP 5.4 or higher version.

Syntax

array|string|int mb_get_info(str $type = "all")

Parameters

It accepts only a single parameter to get the multibyte information.

$type − If the type parameter is not specified or it is specified as "all", then it will return the following information −

"internal_encoding", "http_input", "http_output", "http_output_conv_mimetypes", "mail_charset", "mail_header_encoding", "mail_body_encoding", "illegal_chars", "encoding_translation", "language", "detect_order", "substitute_character", "strict_detection"

If the type parameter is specified as any of the following −

"internal_encoding", "http_input", "http_output", "http_output_conv_mimetypes", "mail_charset", "mail_header_encoding", "mail_body_encoding", "illegal_chars", "encoding_translation", "language", "detect_order", "substitute_character" or "strict_detection",

then it will return the specified setting parameter.

Return Values

mb_get_info() returns an array of type information if the type is not specified, otherwise, it returns a specific type. It will return false on failure.

Note − From PHP 8.0.0, the types "func_overload" and "func_overload_list" are not supported.

Example

<?php
   $string=mb_get_info();
   print_r($string);
?>

Output

Array
(
   [internal_encoding] => UTF-8
   [http_output] => UTF-8
   [http_output_conv_mimetypes] => ^(text/|application/xhtml\+xml)
   [mail_charset] => UTF-8
   [mail_header_encoding] => BASE64
   [mail_body_encoding] => BASE64
   [illegal_chars] => 0
   [encoding_translation] => Off
   [language] => neutral
   [detect_order] => Array
      (
         [0] => ASCII
         [1] => UTF-8
      )

   [substitute_character] => 63
   [strict_detection] => Off
)
raja
Published on 11-Oct-2021 13:06:33
Advertisements