Urmila Samariya

Urmila Samariya

108 Articles Published

Articles by Urmila Samariya

Page 5 of 11

PHP – Find the last occurrence of a needle within a haystack using the iconv_strrpos() function

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

In PHP, the iconv_strrpos() function is used to find the last occurrence of a needle within a haystack. This function returns the character position of the last match in a string, supporting various character encodings. Syntax iconv_strrpos(string $haystack, string $needle, ?string $encoding = null): int|false Parameters iconv_strrpos() accepts three parameters: $haystack, $needle and $encoding. $haystack − The whole string to search within. $needle − The substring to search for in the haystack. $encoding − The character encoding. If omitted or null, uses iconv.internal_encoding. Return Values iconv_strrpos() returns the numeric ...

Read More

PHP – How to return the character count of a string using iconv_strlen()?

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

In PHP, the iconv_strlen() function is used to return the character count of a given string. This function is particularly useful for multibyte character encodings where regular strlen() might give incorrect results. It was introduced in PHP 5 and the encoding parameter became nullable from PHP 8.0. Syntax int|false iconv_strlen(string $string, ?string $encoding = null) Parameters This function accepts two parameters: $string − The input string to count characters from. $encoding − The character encoding to use. If omitted or null, the value of iconv.internal_encoding configuration option is used. Return ...

Read More

PHP – Set the current setting for character encoding conversion using iconv_set_encoding() function

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

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 More

PHP – Compose a MIME header field using iconv_mime_encode() function

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

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 More

PHP – How to decode a MIME header field using iconv_mime_decode() function?

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

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 More

PHP – Decode multiple MIME header fields at once using iconv_mime_decode_headers()

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

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 More

PHP – Retrieve internal configuration variables of iconv extension using iconv_get_encoding() function

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

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

PHP – How to get the square root of an arbitrary precision number using bcsqrt() function?

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

In PHP, the bcsqrt() function is used to get the square root of an arbitrary precision number. It accepts the arbitrary precision number as a string and gives the square root of the number after scaling the result to the specified precision. Syntax string bcsqrt($num_string, $scale) Parameters The bcsqrt() function accepts two different parameters: $num_string and $scale. $num_string − It represents the number whose square root to be evaluated. It is a string-type parameter. $scale − It indicates the number of digits that appear ...

Read More

PHP – How to set or get the default scale parameter for all bc math functions using bcscale() function?

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

In PHP, the bcscale() function is used to set the default scale parameter for all bc math functions. This function sets the default number of decimal places for all following calls to bc math functions that do not explicitly specify a scale parameter. Syntax int bcscale(int $scale) Parameters The bcscale() function accepts a single mandatory parameter − $scale − An integer that specifies the number of digits after the decimal point. The default value is 0. Return Value The bcscale() function returns the old scale value as an integer. Example ...

Read More

PHP – bcpowmod() function

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

In PHP, bcpowmod() function is used to raise an arbitrary precision base number to another exponent number, reduced by a specified modulus. The bcpowmod() function accepts three arbitrary precision numbers as strings and returns the base number raised to the exponent modulo number after scaling the result to the specified precision. Syntax string bcpowmod(string $base, string $exponent, string $modulus, int $scale = 0) Parameters The bcpowmod() function accepts four different parameters − $base, $exponent, $modulus and $scale. $base − It represents the base number. It is a string type parameter. $exponent − ...

Read More
Showing 41–50 of 108 articles
« Prev 1 3 4 5 6 7 11 Next »
Advertisements