Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Server Side Programming Articles
Page 1004 of 2109
PHP – Set the current setting for character encoding conversion using iconv_set_encoding() function
In PHP, the iconv_set_encoding() function is used to set the current character encoding conversion. It is an inbuilt function in PHP that changes the value of the internal configuration variable specified by type to encoding. Syntax string iconv_set_encoding(string $type, string $encoding) Parameters iconv_set_encoding() takes two parameters − $type − The $type parameter can be input_encoding, output_encoding or internal_encoding. $encoding − The $encoding parameter is used for the character set. Return Values iconv_set_encoding() returns TRUE on success and FALSE on failure. Example Here's how to set different encoding ...
Read Morestrxfrm() in C/C++
The strxfrm() function transforms a source string according to the current locale's collating sequence and copies the transformed string to a destination buffer. It is declared in header file and is useful for locale-sensitive string comparisons. Syntax size_t strxfrm(char *destination, const char *source, size_t number); Parameters destination − Pointer to the destination buffer where transformed characters will be copied source − Pointer to the null-terminated source string to be transformed number − Maximum number of characters to copy to destination Return Value Returns the length of the transformed string ...
Read MorePHP – Compose a MIME header field using iconv_mime_encode() function
In PHP, the iconv_mime_encode() function is used to compose MIME header fields. This built-in function creates properly encoded headers that can contain non-ASCII characters, commonly used in email headers and HTTP responses. Syntax string iconv_mime_encode(string $field_name, string $field_value, array $options=[]) The function returns a string representing a valid MIME header field ? Subject: =?ISO-8859-1?Q?Pr=FCfung_f=FFr?= Entwerfen von einer MIME kopfzeile Note − In the above example, Subject is the field name, and the portion beginning with "=ISO-8859-1?..." is the encoded field value. Parameters The function accepts three parameters − ...
Read Morestrcspn() in C
The strcspn() function in C counts the number of characters in the initial segment of a string that do not match any character from a second string. It is declared in the string.h header file and returns the length of the initial segment of the first string before the first occurrence of any character from the second string. Syntax size_t strcspn(const char *string1, const char *string2); Parameters: string1 − The string to be scanned string2 − The string containing characters to search for in string1 Return Value: Returns the number of characters ...
Read MoreWhat is the size of void pointer in C/C++ ?
The size of void pointer varies from system to system. If the system is 16-bit, size of void pointer is 2 bytes. If the system is 32-bit, size of void pointer is 4 bytes. If the system is 64-bit, size of void pointer is 8 bytes. This is because a pointer stores memory addresses, and the size depends on the system's addressing capability. Syntax To find the size of a void pointer, use the sizeof() operator: sizeof(void*) sizeof(pointer_variable) Example: Finding Size of Void Pointer The following example demonstrates how to find the size ...
Read MorePHP – How to decode a MIME header field using iconv_mime_decode() function?
In PHP, iconv_mime_decode() function is used to decode MIME-encoded header fields commonly found in email messages. This function handles encoded text that uses formats like Base64 or Quoted-Printable encoding within MIME headers. Syntax string iconv_mime_decode(string $string, int $mode = 0, string $encoding = null) Parameters The iconv_mime_decode() function accepts three parameters − $string − The MIME-encoded header string to decode (required). $mode − Optional parameter that controls decoding behavior. Available constants: ICONV_MIME_DECODE_STRICT − Enforces strict RFC compliance (disabled by default due to broken mail clients) ICONV_MIME_DECODE_CONTINUE_ON_ERROR − Continues processing despite grammatical ...
Read Morefgets() and gets() in C
In C, fgets() and gets() are functions used to read strings from input streams. The key difference is that fgets() is safe and checks array bounds, while gets() is unsafe and has been removed from C11 standard due to buffer overflow vulnerabilities. fgets() Function The fgets() function reads a string from a specified stream until a newline character or the specified limit is reached − Syntax char *fgets(char *string, int size, FILE *stream); Parameters: string − Pointer to character array where the string will be stored size − Maximum number of characters ...
Read MorePHP – Decode multiple MIME header fields at once using iconv_mime_decode_headers()
In PHP, iconv_mime_decode_headers() function is used to decode multiple MIME header fields at once. It is an in-built function in PHP that processes encoded headers commonly found in email messages. Syntax iconv_mime_decode_headers($str_headers, $int_mode, $str_encoding) Parameters The iconv_mime_decode_headers() function accepts three different parameters − $headers, $mode and $encoding. $headers − The encoded headers as a string. Contains the MIME header fields to be decoded. $mode − Determines the behavior when encountering malformed MIME header fields. Can use any combination of the following bitmasks: ICONV_MIME_DECODE_STRICT − Decodes headers in full conformance with standards. ...
Read Moresize_t data type in C
The size_t data type is an unsigned integral type in C that represents the size of any object in bytes. It is returned by the sizeof operator and commonly used for array indexing, loop counters, and memory size calculations. Since it represents sizes, size_t can never be negative. Syntax size_t variable_name; const size_t variable_name = value; Where variable_name is the name of the variable of type size_t. Example: Basic Usage of size_t Here's an example demonstrating size_t for array operations and size calculations − #include #include #include ...
Read MorePHP – Retrieve internal configuration variables of iconv extension using iconv_get_encoding() function
In PHP, the iconv_get_encoding() function is used to retrieve the internal configuration variables of the iconv extension. This function allows you to check the current encoding settings that are being used by the iconv functions for character set conversion. Syntax mixed iconv_get_encoding(string $type = "all") Parameters The iconv_get_encoding() function accepts one optional parameter: $type − Specifies which encoding type to retrieve. The valid values are: all − Returns all encoding settings (default) input_encoding − Returns the input encoding setting ...
Read More