Php convert cyr string
From w3cyberlearnings
Contents |
PHP function convert_cyr_string
This function converts a string from one Cyrillic character set to another. For additional knowledge, please check: http://en.wikipedia.org/wiki/Cyrillic_script
Syntax convert_cyr_string
- string: string input
- from: from cyrillic character set as single character.
- to: target cyrillic character set as single character.
convert_cyr_string(string, from , to );
Supported Character set
Char - Detail
- k - koi8-r (http://en.wikipedia.org/wiki/KOI8-R)
- w - windows-1251 (http://en.wikipedia.org/wiki/Windows-1251)
- i - iso8859-5 (http://en.wikipedia.org/wiki/ISO_8859-5)
- a - x-cp866
- d - x-cp866
- m - x-mac-cyrillic (http://en.wikipedia.org/wiki/Macintosh_Cyrillic_encoding)
Example 1
<?php $result = convert_cyr_string("§ Ё ©", "w", "k"); echo $result; ?>
Output
÷. ò. ÷¿
Example 2
<?php $result = convert_cyr_string("сВМПЛП", "k", "w"); echo $result; ?>
Output
ÿ ï ï ï ï ï