note 65414 deleted from function.str-replace by bjori
| From: | bjori@php.net | Date: | Sun, 30 Apr 2006 13:39:18 +0000 |
| Subject: | note 65414 deleted from function.str-replace by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-110181@lists.php.net to get a copy of this message | ||
Note Submitter: dmitry at dest dot by
Reason: non-english
----
Function for small texts.
function cyr2lat($str) {
$str = trim($str);
$str = strtolower($str);
$str = str_replace("а", "a", $str);
$str = str_replace("б", "b", $str);
$str = str_replace("в", "v", $str);
$str = str_replace("г", "g", $str);
$str = str_replace("д", "d", $str);
$str = str_replace("е", "e", $str);
$str = str_replace("Ñ", "e", $str);
$str = str_replace("ж", "j", $str);
$str = str_replace("з", "z", $str);
$str = str_replace("и", "i", $str);
$str = str_replace("й", "i", $str);
$str = str_replace("к", "k", $str);
$str = str_replace("л", "l", $str);
$str = str_replace("м", "m", $str);
$str = str_replace("н", "n", $str);
$str = str_replace("о", "o", $str);
$str = str_replace("п", "p", $str);
$str = str_replace("Ñ", "r", $str);
$str = str_replace("Ñ", "s", $str);
$str = str_replace("Ñ", "t", $str);
$str = str_replace("Ñ", "y", $str);
$str = str_replace("Ñ", "f", $str);
$str = str_replace("Ñ
", "h", $str);
$str = str_replace("Ñ", "c", $str);
$str = str_replace("Ñ", "ch", $str);
$str = str_replace("Ñ", "sh", $str);
$str = str_replace("Ñ", "sch", $str);
$str = str_replace("Ñ", "", $str);
$str = str_replace("Ñ", "i", $str);
$str = str_replace("Ñ", "'", $str);
$str = str_replace("Ñ", "e", $str);
$str = str_replace("Ñ", "u", $str);
$str = str_replace("Ñ", "ya", $str);
$str = str_replace("â", "_", $str);
return $str;
}
$stri = "ÐбÑкновеннÑй пÑимеÑ";
$stri = cyr2lat($stri);
print $stri;