Return Array of All Supported Encodings with mb_list_encodings in PHP

Urmila Samariya
Updated on 11-Oct-2021 13:17:35

331 Views

The mb_list_encodings() function in PHP is used to return an array of all supported encodings. This function is supported in PHP 5 or higher version.Syntaxarray mb_list_encodings()Parametersmb_list_encodings() takes no parameters.Return ValuesThis function returns a numerically indexed array.Errors/Exceptionsmb_list_encodings() does not produce any errors.Examplemb_list_encodings() does not produce any errors.OutputIt will produce the following output −array(87) {    [0]=> string(4) "pass"    [1]=> string(4) "auto"    [2]=> string(5) "wchar"    [3]=> string(7) "byte2be"    [4]=> string(7) "byte2le"    [5]=> string(7) "byte4be"    [6]=> string(7) "byte4le"    [7]=> string(6) "BASE64"    [8]=> string(8) "UUENCODE"    [9]=> string(13) ... Read More

Get or Set HTTP Output Character Encoding with mb_http_output

Urmila Samariya
Updated on 11-Oct-2021 13:11:03

391 Views

The mb_http_output() function in PHP is used to get or set the HTTP output character encoding. An output, after this function is called, will be converted from the set internal encoding to the specified encoding.Syntaxstring|bool mb_http_output(str $encoding = null)Parametersmb_http_output() accepts only a single parameter −$encoding − It is used to set the HTTP output character encoding to the encoding. If the encoding is omitted, then mb_http_output() will return the current HTTP output character encoding.Return ValuesIf the encoding is omitted, then the mb_http_output() function will return the current HTTP output character encoding. Otherwise, it returns True on success and False on ... Read More

Detect HTTP Input Character Encoding with mb_http_input in PHP

Urmila Samariya
Updated on 11-Oct-2021 13:08:36

608 Views

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.Syntaxarray|string mb_http_input(str $type=null)Parametersmb_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, andI for the whole list (it will return array).If the type is omitted, then it returns the last input type processed.Return Valuesmb_http_input() returns the character encoding name ... Read More

Get Internal Settings of mbstring with mb_get_info in PHP

Urmila Samariya
Updated on 11-Oct-2021 13:06:33

160 Views

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.Syntaxarray|string|int mb_get_info(str $type = "all")ParametersIt 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 ... Read More

PHP mb_eregi_replace Function

Urmila Samariya
Updated on 11-Oct-2021 13:02:17

248 Views

In PHP, mb_eregi_replace() is used to replace a regular expression with a multibyte support, ignoring case. This function will scan the string for matches to the pattern, then it will replace the matched text with the replacement. This function is supported in PHP 4.2 or higher version.Syntaxstring mb_eregi_replace(str $pattern, str $replacement, str $string, str $options)Parametersmb_eregi_replace() accepts the following four parameters −$pattern − This parameter is used for the regular expression pattern and it may be used multibyte characters. The case will be ignored.$replacement − This parameter is used for text replacement.$string − The string parameter is used to search the ... Read More

PHP mb_ereg_replace Function for Multibyte Regular Expressions

Urmila Samariya
Updated on 11-Oct-2021 12:58:56

722 Views

In PHP, mb_ereg_replace() is used to replace a regular expression with a multibyte support. It scans the string for matches to pattern, then it replaces the matched text with the replacement.Syntaxstring mb_ereg_replace(str $pattern, $str $replacement, str $string, str $options)ParametersThe function accepts the following four parameters −$pattern − This parameter is used for the regular expression pattern. It may use multibyte characters in a pattern.$replacement − This replacement parameter is used to replace the given text.$string − This parameter is used to check the string.$options − This parameter is used to check the search option.Return Valuesmb_ereg_replace() returns success for the resultant ... Read More

PHP mb_ereg_replace_callback Function

Urmila Samariya
Updated on 11-Oct-2021 12:56:47

185 Views

In PHP, mb_ereg_replace_callback() function is used to perform a regular expression search and replace it with a multibyte support using a callback. It will scan the strings and match them with a pattern, then it will replace the matched text with the output of the callback function. This function is like the mb_ereg_replace() function. It is supported in PHP 5.4 or higher version.Syntaxstring mb_ereg_replace_callback(str $pattern, callback $callback, str $string, str $options)ParametersThe function accepts the following four parameters −$pattern − This parameter is used for the regular expression pattern. It may use multibyte characters in a pattern.$callback − This parameter will ... Read More

Match Regular Expression Using mb_ereg_match in PHP

Urmila Samariya
Updated on 11-Oct-2021 12:53:09

480 Views

In PHP, mb_ereg_match() function is used for matching a given string with a regular expression pattern. This function only matches the string from the beginning of the string and it is not necessary that it will match the string till the end. This function will return true or 1 if a match is found, else it will return False or 0.Syntaxbool mb_ereg_match(str $pattern, str $string, str $options)ParametersIt accepts the following three parameters −$pattern − This parameter is used for the regular expression.$string − This parameter is being evaluated.$options − It is used for the search.Return Valuesmb_ereg_match() returns true or 1 ... Read More

Get Aliases of a Known Encoding Type Using mb_encoding_aliases in PHP

Urmila Samariya
Updated on 11-Oct-2021 12:49:47

203 Views

In PHP, mb_encoding_aliases() is used to get the aliases of a known encoding type. This function is supported in PHP 5 or higher version.Syntaxarray mb_encoding_aliases(str $encoding)ParametersIt accepts only one parameter, $encoding, which is the encoding type checked for aliases.Return ValuesIt returns a numerically indexed array of encoding aliases on success or it returns False on failure.Errors/ExceptionsIf the encoding is not known, then it gives an E_WARNING level error.Example 1OutputArray ( [0] => ANSI_X3.4-1968 [1] => iso-ir-6 [2] => ANSI_X3.4-1986 [3] => ISO_646.irv:1991 [4] => US-ASCII ... Read More

Encode String for MIME Header using mb_encode_mimeheader in PHP

Urmila Samariya
Updated on 11-Oct-2021 12:43:16

588 Views

In PHP, mb_encode_mimeheader() function is used to encode a string for MIME (Multipurpose Internet Mail Extensions) header. It encodes a given string by the MIME header encoding scheme.Syntaxstring mb_encode_mimeheader(str $string, str $charset, str $transfer_encoding, str $newLine, int $indent)ParametersThe mb_encode_mimeheader() function accepts five parameters −$string − This parameter is used to encode the string. Its encoding should be the same as mb_internal_encoding()$charset − This parameter specifies the character set name in which the string is represented.$transfer_encoding − This parameter specifies the scheme of MIME encoding. It should be base64 (B) or Quoted-printable (Q). If not given, then it falls back to ... Read More

Advertisements