PHP function convert_cyr_string() – Convert from one Cyrillic character set to another

The convert_cyr_string() function is used to convert a string from one Cyrillic character-set to another set. It was introduced in PHP3. The character sets to be converted are specified with a single character code. Look at the types that are supported by this function:

“k - koi8-r
“w - windows-1251 “i - iso8859-5
“a - x-cp866
“d - x-cp866
“m - x-mac-cyrillic

If an invalid code is specified for the source and/or destination argument, the function generates a warning.

Note: The presence of a null byte (\0) in the string halts the translation at that point.

Syntax:

convert_cyr_string(string $str, string $from, string $to): string

Parameters

Parameter Description
str The string to be converted.
from The source Cyrillic character set, as a single character.
to The target Cyrillic character set, as a single character.

Return Values

Returns the converted string.

Related Post