Exemple #1
0
 static function totranslit($text)
 {
     //транслит
     $text = WRA::strtolower_utf8($text);
     $trans = array('а' => 'a', 'б' => 'b', 'в' => 'v', 'г' => 'g', 'д' => 'd', 'е' => 'e', 'ё' => 'jo', 'ж' => 'zh', 'з' => 'z', 'и' => 'i', 'й' => 'j', 'к' => 'k', 'л' => 'l', 'м' => 'm', 'н' => 'n', 'о' => 'o', 'п' => 'p', 'р' => 'r', 'с' => 's', 'т' => 't', 'у' => 'y', 'ф' => 'f', 'х' => 'kh', 'ц' => 'ts', 'ч' => 'ch', 'ш' => 'sh', 'щ' => 'sch', 'ъ' => '', 'ы' => 'y', 'ь' => '', 'э' => 'e', 'ю' => 'ju', 'я' => 'ja', 'і' => 'i', ' ' => '_', 'є' => 'ie', 'і' => 'i', 'ї' => 'i', 'ґ' => 'g');
     $tr2 = array_values($trans);
     $tr1 = array_keys($trans);
     for ($i = 0; $i < count($trans); $i++) {
         $text = str_replace($tr1[$i], $tr2[$i], $text);
     }
     return $text;
 }