- 001
- 002
- 003
- 004
- 005
- 006
- 007
- 008
- 009
- 010
- 011
- 012
- 013
- 014
- 015
- 016
- 017
- 018
- 019
- 020
- 021
- 022
- 023
- 024
- 025
- 026
- 027
- 028
- 029
- 030
- 031
- 032
- 033
- 034
- 035
- 036
- 037
- 038
- 039
- 040
- 041
- 042
- 043
- 044
- 045
- 046
- 047
- 048
- 049
- 050
- 051
- 052
- 053
- 054
- 055
- 056
- 057
- 058
- 059
- 060
- 061
- 062
- 063
- 064
- 065
- 066
- 067
- 068
- 069
- 070
- 071
- 072
- 073
- 074
- 075
- 076
- 077
- 078
- 079
- 080
- 081
- 082
- 083
- 084
- 085
- 086
- 087
- 088
- 089
- 090
- 091
- 092
- 093
- 094
- 095
- 096
- 097
- 098
- 099
- 100
public function translate($text, $save_register = false){
$length = mb_strlen($text, 'utf-8');
if (!$save_register)
$text = mb_strtolower($text, 'utf-8');
$translit = '';
for ($i=0; $i<=$length-1; $i++){
$letter = iconv_substr($text, $i, 1, 'utf-8');
switch ($letter){
case 'а':
$translit .= 'a';
break;
case 'б':
$translit .= 'b';
break;
case 'в':
$translit .= 'v';
break;
case 'г':
$translit .= 'g';
break;
case 'д':
$translit .= 'd';
break;
case 'е':
$translit .= 'e';
break;
case 'ё':
$translit .= 'yo';
break;
case 'ж':
$translit .= 'zh';
break;
case 'з':
$translit .= 'z';
break;
case 'и':
$translit .= 'i';
break;
case 'й':
$translit .= 'j';
break;
case 'к':
$translit .= 'k';
break;
case 'л':
$translit .= 'l';
break;
case 'м':
$translit .= 'm';
break;
case 'н':
$translit .= 'n';
break;
case 'о':
$translit .= 'o';
break;
case 'п':
$translit .= 'p';
break;
case 'р':
$translit .= 'r';
break;
case 'с':
$translit .= 's';
break;
case 'т':
$translit .= 't';
break;
case 'у':
$translit .= 'u';
break;
case 'ф':
$translit .= 'f';
break;
case 'х':
$translit .= 'h';
break;
case 'ц':
$translit .= 'c';
break;
case 'ч':
$translit .= 'ch';
break;
case 'ш':
$translit .= 'sh';
break;
case 'щ':
$translit .= 'w';
break;
case 'ы':
$translit .= 'y';
break;
case 'э':
$translit .= 'je';
break;
case 'ю':
$translit .= 'ju';
break;
case 'я':
$translit .= 'ya';
Vasiliy 22.09.2011 10:39 # +4
vkontakte 22.09.2011 11:56 # 0
KirAmp 22.09.2011 15:02 # 0
ling 22.09.2011 15:35 # +5
nethak 23.09.2011 14:50 # 0
guest8 09.04.2019 11:33 # −999