Created
November 21, 2010 21:22
-
-
Save robertbasic/709167 to your computer and use it in GitHub Desktop.
translit
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
str_replace(array('dž', 'lj', 'nj', 'DŽ', 'Dž', 'LJ', 'Lj', 'NJ', 'Nj', 'a', 'b', 'c', 'ć', 'č', 'd', 'đ', 'e', 'f', 'g', 'i', 'j', 'h', 'k', 'l', 'm', 'n', 'o', 'p', 'r', 's', 'š', 'u', 't', 'v', 'z', 'ž', 'А', 'B', 'C', 'Ć', 'Č', 'D', 'Đ', 'E', 'F', 'G', 'I', 'J', 'H', 'K', 'L', 'M', 'N', 'O', 'P', 'R', 'S', 'Š', 'U', 'T', 'V', 'Z', 'Ž'), array('џ', 'љ', 'њ', 'Џ', 'Џ', 'Љ', 'Љ', 'Њ', 'Њ', 'а', 'б', 'ц', 'ћ', 'ч', 'д', 'ђ', 'е', 'ф', 'г', 'и', 'ј', 'х', 'к', 'л', 'м', 'н', 'о', 'п', 'р', 'с', 'ш', 'у', 'т', 'в', 'з', 'ж', 'А', 'Б', 'Ц', 'Ћ', 'Ч', 'Д', 'Ђ', 'Е', 'Ф', 'Г', 'И', 'Ј', 'Х', 'К', 'Л', 'М', 'Н', 'О', 'П', 'Р', 'С', 'Ш', 'У', 'Т', 'В', 'З', 'Ж'), $text); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ispravljeno i malo organizovano
function translitToLatin($text) {
$latin = array('DJ', 'Dj', 'dj', 'DŽ', 'Dž', 'dž', 'LJ', 'Lj', 'lj', 'NJ', 'Nj', 'nj', 'a', 'b', 'c', 'ć', 'č', 'd', 'đ', 'e', 'f', 'g', 'i', 'j', 'h', 'k', 'l', 'm', 'n', 'o', 'p', 'r', 's', 'š', 'u', 't', 'v', 'z', 'ž', 'А', 'B', 'C', 'Ć', 'Č', 'D', 'Đ', 'E', 'F', 'G', 'I', 'J', 'H', 'K', 'L', 'M', 'N', 'O', 'P', 'R', 'S', 'Š', 'U', 'T', 'V', 'Z', 'Ž');
$cyr = array('Ꚋ', 'Ꚋ', 'ђ', 'Џ', 'Џ', 'џ', 'Љ', 'Љ', 'љ', 'Њ', 'Њ', 'њ', 'а', 'б', 'ц', 'ћ', 'ч', 'д', 'ђ', 'е', 'ф', 'г', 'и', 'ј', 'х', 'к', 'л', 'м', 'н', 'о', 'п', 'р', 'с', 'ш', 'у', 'т', 'в', 'з', 'ж', 'А', 'Б', 'Ц', 'Ћ', 'Ч', 'Д', 'Ђ', 'Е', 'Ф', 'Г', 'И', 'Ј', 'Х', 'К', 'Л', 'М', 'Н', 'О', 'П', 'Р', 'С', 'Ш', 'У', 'Т', 'В', 'З', 'Ж');
return str_replace($cyr, $latin, $text);