Articles on Trending Technologies

Technical articles with clear explanations and examples

Tutorix - AI Tutor

PHP – mb_strimwidth (multybyte strimwidth) function

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

Swapping two variable value without using third variable in C/C++

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

In C programming, swapping two variables without using a third variable can be accomplished using arithmetic operations. This technique saves memory and demonstrates clever use of mathematical operations. Syntax a = a + b; b = a - b; a = a - b; Method 1: Using Addition and Subtraction This approach uses arithmetic operations to swap values without requiring additional memory − #include int main() { int a = 10, b = 20; printf("Before swapping: a ...

Read More

PHP – mb_preferred_mime_name() function

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 173 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 739 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 2K+ 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 491 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 892 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 694 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

Return values of printf() and scanf() in C

Samual Sam
Samual Sam
Updated on 15-Mar-2026 13K+ Views

The printf() and scanf() functions are required for output and input respectively in C. Both of these functions are library functions and are defined in the stdio.h header file. Understanding their return values is crucial for error handling and program flow control. Syntax int printf(const char *format, ...); int scanf(const char *format, ...); The printf() Function Return Value The printf() function returns the number of characters that are printed successfully. If there is an error during output, it returns a negative value. Example #include int main() { ...

Read More

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

Urmila Samariya
Urmila Samariya
Updated on 15-Mar-2026 246 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
Showing 22071–22080 of 61,298 articles
Advertisements