Last active
August 29, 2015 14:17
-
-
Save iredun/e98911e619a6b7526822 to your computer and use it in GitHub Desktop.
Заменяет сиволы в строке с русского на английский
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
function translit($str){ | |
$alphavit = array( | |
/*--*/ | |
"а"=>"a","б"=>"b","в"=>"v","г"=>"g","д"=>"d","е"=>"e", | |
"ё"=>"yo","ж"=>"j","з"=>"z","и"=>"i","й"=>"i","к"=>"k","л"=>"l", "м"=>"m", | |
"н"=>"n","о"=>"o","п"=>"p","р"=>"r","с"=>"s","т"=>"t", | |
"у"=>"y","ф"=>"f","х"=>"h","ц"=>"c","ч"=>"ch", "ш"=>"sh","щ"=>"sh", | |
"ы"=>"i","э"=>"e","ю"=>"u","я"=>"ya", | |
/*--*/ | |
"А"=>"A","Б"=>"B","В"=>"V","Г"=>"G","Д"=>"D","Е"=>"E", "Ё"=>"Yo", | |
"Ж"=>"J","З"=>"Z","И"=>"I","Й"=>"I","К"=>"K", "Л"=>"L","М"=>"M", | |
"Н"=>"N","О"=>"O","П"=>"P", "Р"=>"R","С"=>"S","Т"=>"T","У"=>"Y", | |
"Ф"=>"F", "Х"=>"H","Ц"=>"C","Ч"=>"Ch","Ш"=>"Sh","Щ"=>"Sh", | |
"Ы"=>"I","Э"=>"E","Ю"=>"U","Я"=>"Ya", | |
"ь"=>"","Ь"=>"","ъ"=>"","Ъ"=>"", " "=>"_" | |
); | |
return strtr($str, $alphavit); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment