Programming Articles

Page 1013 of 2547

PHP – mb_strrichr() function

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

The mb_strrichr() function in PHP is used to find the last occurrence of a character in a string within another string. This function is case-insensitive, unlike mb_strrchr(). This function finds the last occurrence of a needle in the given haystack string and returns that portion of the haystack. It returns false if a needle is not found in the haystack string. Syntax string mb_strrichr( $str_haystack, $str_needle, $bool_before_needle=false, $str_encoding ) Parameters mb_strrichr() accepts the following four parameters − ...

Read More

PHP – mb_eregi() function

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

The mb_eregi() function in PHP performs case-insensitive regular expression matching with multibyte support. Unlike mb_ereg(), it ignores case when comparing patterns, making it useful for international text processing. Syntax int mb_eregi( string $pattern, string $string, array &$matches = null ) Parameters pattern − The regular expression pattern to match (case-insensitive) string − The input string to search within matches − Optional array to store matched substrings. If matches are found, they are stored in this array Return Value Returns the number ...

Read More

PHP – mb_strrpos() function

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

The mb_strrpos() function in PHP is used to find the position of the last occurrence of a string in another string. This function performs the multibyte safe strrpos() operation based on the number of characters and is particularly useful when working with multibyte character encodings like UTF-8. Syntax int mb_strrpos( string $haystack, string $needle, int $offset = 0, string $encoding = null ) Parameters mb_strrpos() accepts the following four parameters − $haystack − The string to search in. $needle − ...

Read More

PHP – mb_strimwidth (multybyte strimwidth) function

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 822 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 158 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 705 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

How to print a variable name in C?

karthikeya Boyini
karthikeya Boyini
Updated on 15-Mar-2026 1K+ Views

In C programming, you can print the name of a variable as a string using the stringizing operator (#) within a macro. This technique is useful for debugging and logging purposes where you want to display variable names along with their values. Syntax #define MACRO_NAME(variable) #variable The # operator converts the macro parameter into a string literal. Example Here's how to create a macro that prints variable names − #include #define VariableName(name) #name int main() { int age = 25; char ...

Read More

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

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 461 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

C function to Swap strings

Samual Sam
Samual Sam
Updated on 15-Mar-2026 833 Views

In C programming, swapping strings involves exchanging the contents of two string variables. This can be achieved through character-by-character swapping or by swapping string pointers. Syntax // Character-by-character swapping void swapStrings(char str1[], char str2[]); // Pointer swapping void swapPointers(char **str1, char **str2); Method 1: Character-by-Character Swapping This method swaps each character of the strings individually − #include #include int main() { char st1[] = "My 1st string"; char st2[] = "My 2nd string"; char swap; ...

Read More

PHP – Detect HTTP input character encoding with mb_http_input()

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 670 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
Showing 10121–10130 of 25,466 articles
Advertisements