I have a problem with my string. After the for loop all I get some other symbols instead of my exact cyrillic letters. The goal is to change cyrillic letters: ąčęėįšųūž into this: a1, c2, e1, e2, i1, s2, u1, u2, z2. I have came up with tihs:
$ltSymbolsArray = array(
'a1' => 'ą',
'c2' => 'č',
'e1' => 'ę',
'e2' => 'ė',
'i1' => 'į',
's2' => 'š',
'u1' => 'ų',
'u2' => 'ū',
'z2' => 'ž'
);
$string = 'ąsąžadcę';
for ($i = 0; $i < strlen($string); $i++) {
foreach ($ltSymbolsArray as $key => $value) {
if ($string[$i] == $value) {
$string[$i] = $key;
}
}
}
It looks like a simple solution, but I can't handle the encoding. Encoding is a mystery for me so I would really appreciate any help on this problem.