Home >>PHP String Functions >PHP convert_cyr_string() Function

PHP convert_cyr_string() Function

PHP convert_cyr_string() Function

PHP convert_cyr_string() function is used in PHP for the conversion of any given input string form the set of one Cyrillic character to the set of another character. This convert_cyr_string() function is an in-built function of PHP. In this convert_cyr_string() function we can pass two parameters other from the input string, one of which acts as the source Cyrillic character set and the another one acts as the destination Cyrillic character set. These two arguments which we will pass as the parameters are of single character type.

Syntax :

convert_cyr_string ( $string, $from, $to )

In $string parameter we pass the given input string which is to be converted from one Cyrillic character-sets to another Cyrillic character-sets .In the $from & $to parameters we pass the Cyrillic character-sets. The Cyrillic character-sets which are supported for this convert_cyr_string() function are:-

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


Let's have an example for the convert_cyr_string() function:

$str = "PHPTPOINT –¢–µ–Ї—Г—Й–Є–є —Б—З–µ—В";
echo $str . "<br>";
echo convert_cyr_string($str,'m','w'); 
Output: PHPTPOINT –¢–µ–Ї—Г—Й–Є–є —Б—З–µ—В
PHPTPOINT ��� ��� ��� ���� ���� ���� ���� � ��� ���� ���� ��� �

Popular Tutorials