In this article, you will learn about converting one Cyrillic character set to another using convert_cyr_string() function. Before learning about this function, you must know about the CYR character set. The Cyrillic characters set consist of the following character sets.
- k – koi8-r
- w – windows-1251
- i – iso8859-5
- a – x-cp866
- d – x-cp866
- m – x-mac-cyrillic
The convert_cyr_string() convert Cyrillic character-set to another.
What is the syntax of the CONVERT_CYR_STRING() function in PHP?
convert_cyr_string(string,from,to)
Parameter | Description |
---|---|
string | The string to convert from one Cyrillic char set to other – Required |
from | Cyrillic character-set to convert from – Required |
to | Cyrillic character-set to convert to – Required |
examples of the convert_CYR_String method
Example 1. In this example, we takes a string and pass it to the convert_cyr_string() and the result was the converted Cyrillic character-set.
<?php
$str = "Hello PHP.org! æøå";
echo convert_cyr_string($str,'w','a');
?>