Urmila Samariya

Urmila Samariya

108 Articles Published

Articles by Urmila Samariya

Page 2 of 11

PHP – mb_strimwidth (multybyte strimwidth) function

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 800 Views

The mb_strimwidth() function in PHP is used to truncate a multibyte string to a specified width. This function is particularly useful for handling text in different character encodings while maintaining proper string length control. Syntax string mb_strimwidth($str, $start, $width, $trimmarker, $encoding) Parameters mb_strimwidth() accepts five parameters to control string truncation − $str − The input string to be truncated. $start − Starting position for truncation (0-based index). $width − Maximum width of the truncated string. Negative values count from the end. $trimmarker − String appended when truncation occurs (optional). $encoding − Character ...

Read More

PHP – mb_preferred_mime_name() function

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 139 Views

The mb_preferred_mime_name() function in PHP is used to return the MIME charset string for a character encoding. It gets a MIME (Multipurpose Internet Mail Extensions) charset string for the specific encoding. Syntax string mb_preferred_mime_name(string $encoding) Parameters mb_preferred_mime_name() accepts only one parameter − $encoding − The character encoding name to get the MIME charset string for. Return Value The function returns the MIME charset string for the given encoding, or false if no preferred MIME name exists for the encoding. Example 1: Basic Usage Let us see how ...

Read More

PHP – Parse the GET, POST, and COOKIE data using mb_parse_str()

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 689 Views

The mb_parse_str() function in PHP is used to parse URL-encoded data (commonly from GET, POST, and COOKIE) and converts it into an array. It automatically detects the encoding and converts it to the internal encoding, making it useful for handling multibyte character strings. Syntax bool mb_parse_str(string $encoded_string, array &$result) Parameters The mb_parse_str() function accepts the following parameters − $encoded_string − The URL-encoded data string to be parsed. $result − An array that will hold the parsed key-value pairs after decoding and character conversion. Return Values The function returns true ...

Read More

PHP – Get or set the HTTP output character encoding with mb_http_output()

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 438 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. Syntax string|bool mb_http_output(string $encoding = null) Parameters mb_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. ...

Read More

PHP – Detect HTTP input character encoding with mb_http_input()

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 646 Views

The mb_http_input() function in PHP is used to detect the HTTP input character encoding from various sources like GET, POST, COOKIE data, and strings. This function is particularly useful when working with different character encodings in web applications and is supported in PHP 5.4 or higher. Syntax array|string mb_http_input(string $type = null) Parameters mb_http_input() accepts a single optional parameter − $type − Specifies the input type to check for character encoding: G − GET variables P − POST variables C − COOKIE variables S − String variables L − List of ...

Read More

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

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 193 Views

The mb_get_info() function in PHP is used to get the internal settings of mbstring extension. This function is supported in PHP 5.4 or higher version and is essential for debugging and understanding current multibyte string configurations. Syntax array|string|int mb_get_info(string $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 all available mbstring settings. If a specific type is provided, it returns only that setting value. Available type values ...

Read More

PHP – mb_ereg_replace() function – Replace regular expression with multibyte support

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 769 Views

In PHP, mb_ereg_replace() is used to replace a regular expression with multibyte support. It scans the string for matches to pattern, then replaces the matched text with the replacement, making it ideal for handling international characters and Unicode strings. Syntax string mb_ereg_replace(string $pattern, string $replacement, string $string, string $options = null) Parameters The function accepts the following four parameters − $pattern − The regular expression pattern. It may use multibyte characters in the pattern. $replacement − The replacement text used to replace the matched pattern. $string − The input string to be ...

Read More

PHP – mb_ereg_replac_callback() function

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 234 Views

In PHP, mb_ereg_replace_callback() function is used to perform a regular expression search and replace with multibyte support using a callback. It scans strings, matches them with a pattern, then replaces the matched text with the output of the callback function. This function is similar to mb_ereg_replace() but allows custom replacement logic through callbacks. It is supported in PHP 5.4 or higher versions. Syntax string mb_ereg_replace_callback(str $pattern, callback $callback, str $string, str $options) Parameters The function accepts the following four parameters − $pattern − The regular expression pattern. May use multibyte characters. $callback ...

Read More

PHP – Match regular expression using mb_ereg_match()

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 516 Views

In PHP, the 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 and returns true if a match is found, else it returns false. It supports multibyte character sets, making it useful for international text processing. Syntax bool mb_ereg_match(string $pattern, string $string, string $options = null) Parameters It accepts the following three parameters − $pattern − The regular expression pattern to match against. $string − The input string being evaluated. ...

Read More

PHP – Get aliases of a known encoding type using mb_encoding_aliases()

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 260 Views

In PHP, mb_encoding_aliases() is used to get the aliases of a known encoding type. This function returns all alternative names for a specified character encoding, which is useful when working with different systems that may use varying naming conventions for the same encoding. Syntax array mb_encoding_aliases(string $encoding) Parameters $encoding − The encoding type to check for aliases. This must be a valid encoding name recognized by the mbstring extension. Return Value Returns a numerically indexed array of encoding aliases on success, or false on failure. Errors/Exceptions If the encoding is ...

Read More
Showing 11–20 of 108 articles
« Prev 1 2 3 4 5 11 Next »
Advertisements