The following code doesn't work on PHP. The actual result: 'ЯЯЯ' -> 'ЯЯЯ' (should be 'яяя') Why?
function strtolower_rus($string) {
$upper = array('А','Б','В','Г','Д','Е','Ё','Ж','З','И','Й','К','Л','М','Н','О','П','Р','С','Т','У','Ф','Х','Ц','Ч','Ш','Щ','Ъ','Ы','Ь','Э','Ю','Я',' ');
$lower = array('а','б','в','г','д','е','ё','ж','з','и','й','к','л','м','н','о','п','р','с','т','у','ф','х','ц','ч','ш','щ','ъ','ы','ь','э','ю','я',' ');
return strtolower(str_replace($upper, $lower, $string));
}
UPDATED:
I use UTF encoding on the source file. But can't use CP-1251 encoding because apache doesn't accept it. What's a solution?
UPDATED:
Also I have checked the following code:
$lower = array('Я' => 'я');
function strtolower_rus($string) {
return strtolower(strtr($string, $lower));
}
It returns an ugly char instead 'я':(