Created
September 12, 2012 10:43
-
-
Save r37r0m0d3l/3705880 to your computer and use it in GitHub Desktop.
Transliteration function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function translit($cyr_str) | |
{ | |
return strtr($cyr_str, array( | |
'Ґ'=> 'G', 'Ё'=> 'Yo', 'Є'=> 'E', 'Ї'=> 'Yi', 'І'=> 'I', 'і'=> 'i', 'ґ'=> 'g', 'ё'=> 'yo', '№'=> '#', 'є'=> 'e', | |
'ї'=> 'yi', 'А'=> 'A', 'Б'=> 'B', 'В'=> 'V', 'Г'=> 'G', 'Д'=> 'D', 'Е'=> 'E', 'Ж'=> 'Zh', 'З'=> 'Z', 'И'=> 'I', | |
'Й'=> 'Y', 'К'=> 'K', 'Л'=> 'L', 'М'=> 'M', 'Н'=> 'N', 'О'=> 'O', 'П'=> 'P', 'Р'=> 'R', 'С'=> 'S', 'Т'=> 'T', | |
'У'=> 'U', 'Ф'=> 'F', 'Х'=> 'H', 'Ц'=> 'Ts', 'Ч'=> 'Ch', 'Ш'=> 'Sh', 'Щ'=> 'Sch', 'Ъ'=> '`', 'Ы'=> 'Yi', 'Ь'=> '', | |
'Э'=> 'E', 'Ю'=> 'Yu', 'Я'=> 'Ya', 'а'=> 'a', 'б'=> 'b', 'в'=> 'v', 'г'=> 'g', 'д'=> 'd', 'е'=> 'e', 'ж'=> 'zh', | |
'з'=> 'z', 'и'=> 'i', 'й'=> 'y', 'к'=> 'k', 'л'=> 'l', 'м'=> 'm', 'н'=> 'n', 'о'=> 'o', 'п'=> 'p', 'р'=> 'r', | |
'с'=> 's', 'т'=> 't', 'у'=> 'u', 'ф'=> 'f', 'х'=> 'h', 'ц'=> 'ts', 'ч'=> 'ch', 'ш'=> 'sh', 'щ'=> 'sch', 'ъ'=> "`", | |
'ы'=> 'yi', 'ь'=> '', 'э'=> 'e', 'ю'=> 'yu', 'я'=> 'ya' | |
)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment