Urmila Samariya

Urmila Samariya

108 Articles Published

Articles by Urmila Samariya

108 articles

PHP – How to cut out part of a string using iconv_substr()?

Urmila Samariya
Urmila Samariya
Updated on 11-Mar-2026 305 Views

In PHP, the iconv_substr() function is used to cut a portion of a specified string by the offset and length parameters. Suppose we have a string "helloWorld" and we want to cut and show only the string (llowo), then we will select it by using numbers from 2 to 5.Syntaxstring iconv_substr(str $string, int $offset, int $length, str $encoding)Parametersiconv_substr() accepts four parameters: $string, $offset, $length and $encoding.$string− The $string parameter specifies the original string.$offset− If the $offset parameter is non-negative, then the iconv_substr() function cuts the selected portion of the string from beginning at offset character, counting from zero. And if ...

Read More

How to get the pixel height of a character in the specified font using the imagefontheight() function in PHP?

Urmila Samariya
Urmila Samariya
Updated on 11-Mar-2026 340 Views

imagefontheight() is an inbuilt function in PHP that is used to get the pixel height of a character in the specified font.Syntaxint imagefontheight(int $font)Parametersimagefontheight() takes one parameter, $font. It holds the font value. The $font values can be 1, 2, 3, 4, and 5 for the built-in fonts or it can be used by using imageloadfont() function for custom fonts.Return Valuesimagefontheight() returns the pixel height of the font.Example 1OutputFont height: 13Example 2OutputFont height for the font value 1 is 8 Font height for the font value 2 is 13 Font height for the font value 3 is 13 Font height ...

Read More

How to get the pixel width of a character in the specified font using the imagefontwidth() function in PHP?

Urmila Samariya
Urmila Samariya
Updated on 11-Mar-2026 650 Views

imagefontwidth() is an inbuilt function in PHP that is used to get the pixel width of a character in the specified font.Syntaxint imagefontwidth(int $font)Parametersimagefontwidth() takes only one parameter, $font. It holds the font value. The $font values can be 1, 2, 3, 4, and 5 for the built-in fonts or it can be used by using imageloadfont() function for custom fonts.Return Valuesimagefontwidth() returns the pixel width of the font.Example 1OutputFont width: 7Example 2OutputFont width for the font value 1 is 5 Font width for the font value 2 is 6 Font width for the font value 3 is 7 Font ...

Read More

How to copy the palette from one image to another using imagepalettecopy() function in PHP?

Urmila Samariya
Urmila Samariya
Updated on 11-Mar-2026 190 Views

imagepalettecopy() is an inbuilt PHP function that is used to copy the palette from one image to another. This function copies the palette from the source image to the destination image.Syntaxvoid imagepalettecopy(resource $destination, resource $source)Parametersimagepalettecopy() accepts two parameters − $source and $destination.$destination − Specifies the destination image resource.$source − Specifies the source image resource.Return Valuesimagepalettecopy() retuns no values.Example 1OutputExample 2OutputColors in image 1 are 1 Colors in image 2 are 1

Read More

How to get an affine transformation matrix in PHP using imageaffinematrixget()?

Urmila Samariya
Urmila Samariya
Updated on 11-Mar-2026 226 Views

imageaffinematrixget() is an inbuilt function in PHP that is used to get an affine transformation matrix. This function is often used in linear algebra and computer graphics.Syntaxarray imageaffinematrixget(int $type, mixed $options)Parametersimageaffinematrixget() accepts only two parameters: $type and $options.$type − The $type parameter specifies the integer to IMG_AFFINE constants.IMG_AFFINE_TRANSLATEIMG_AFFINE_SCALEIMG_AFFINE_ROTATEIMG_AFFINE_SHEAR_HORIZONTALIMG_AFFINE_SHEAR_VERTICAL$options − If type is IMG_AFFINE_TRANSLATE or IMG_AFFINE_SCALE, options has to be an array with keys x and y, both having float values. If type is IMG_AFFINE_ROTATE, IMG_AFFINE_SHEAR_HORIZONTAL or IMG_AFFINE_SHEAR_VERTICAL, options has to be a float specifying the angle.Return ValuesIt returns an affine transformation matrix, an array with keys from 0 to 5 ...

Read More

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

Urmila Samariya
Urmila Samariya
Updated on 11-Mar-2026 236 Views

In PHP, the iconv_get_encoding() function is used to retrieve the internal configuration variables of iconv extension. This function is an inbuilt PHP function which is being used from PHP 4 version.Syntaxmixed iconv_get_encoding($type = "all")ParameterThe iconv_get_encoding() function is used only single parameter $type.$type − The values of the optional type parameter can beallinput_encodingoutput_encodinginternal_encodingReturn ValueThe iconv_get_encoding() function returns the current value of the internal configuration variable if successful or it returns False on failure. If the type is not present or set to all,  then iconv_get_encoding() returns an array that stores all these variables.Example 1     Outputarray(3) {    ["input_encoding"]=>    string(5) ...

Read More

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

Urmila Samariya
Urmila Samariya
Updated on 11-Mar-2026 496 Views

In PHP, iconv_mime_decode() function is used to decode a MIME header field. This is an inbuilt function in PHP that is used from the PHP 5 version.SyntaxString iconv_mime_decode(string $string, int $mode, string $encoding)ParametersThe iconv_mime_decode() accepts three different parameters− $string, $mode and $encoding. $string and $mode are mandatory parameters, but $encoding is optional.$string − The $string parameter is used for the encoded header. It is a string-type parameter.$mode − The $mode parameter determines the behavior in the event iconv_mime_decode() it encounters the malformed MIME header field. We can specify any combination of the below-given bitmasks.List of bitmasks acceptable to iconv_mime_decode_headers()ICONV_MIME_DECODE_STRICTICONV_MIME_DECODE_CONTINUE_ON_ERRORICONV_MIME_DECODE_STRICT − ...

Read More

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

Urmila Samariya
Urmila Samariya
Updated on 11-Mar-2026 360 Views

In PHP, iconv_mime_encode() function is used to composes a MIME header field. This is an inbuilt PHP function.Syntaxstring iconv_mime_encode(string $field_name, string $field_value, array $options=[])The iconv_mime_encode() function is used to compose and return a string that represents a valid MIME header field, which looks like -Subject: =ISO-8859-1?Q?Pr=FCfung_f=FFCr?= Entwerfen von einer MIME kopfzeileNote− In the above example, Subject - is the field name, and the portion that begins with "=ISO-8859-1?..." is the field value.Parametersiconv_mime_encode() accepts three different parameters − $field_name, $field_value and $options.$field_name − This parameter is used for the field name.$field_value − This parameter is used for the field value.$options − ...

Read More

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

Urmila Samariya
Urmila Samariya
Updated on 11-Mar-2026 317 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.Syntaxstring iconv_set_encoding(string $type, string $encoding)Parametersiconv_set_encoding() takes two parameters − $type and $encoding.$type − The $type parameter can be input_encoding, output_encoding or internal_encoding.$encoding − The $encoding parameter is used for the character set.Return Valuesiconv_set_encoding() returns True on success and False on failure.Example     Outputarray(3) {    ["input_encoding"]=>    string(5) "UTF-8"    ["output_encoding"]=>    string(5) "UTF-8"    ["internal_encoding"]=>    string(5) "UTF-8" }

Read More

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

Urmila Samariya
Urmila Samariya
Updated on 11-Mar-2026 386 Views

In PHP, the iconv_strlen() function is used to return the character count of a given string. This is an inbuilt function in PHP that is first used in PHP 5 version. Encoding is nullable from PHP 8.0.Syntaxstring iconv_strlen(str $string, str $encoding)ParametersThis PHP function accepts two parameters: $string and $encoding.$string− The $string parameter is used for the input string.$encoding− If the $encoding parameter is absent or it is null, then the string is assumed to be encoded in iconv.internal_encoding.Return ValuesThe iconv_strlen() function returns the list of characters count which is present in the given string, or it returns False if an error ...

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