static private function removeAccentedLetters($input){
for ($i = 0; $i < strlen($input); $i++) {
$input[$i]=self::simplify($input[$i]);
}
return $input;
}
static private function simplify($in){
switch ($in) {
case 'Á':
return 'A';
case 'á':
return 'a';
default:
return $in;
}
}
This is the code. Doesn’t work. Any thoughts?
Oh yeah. It always enters the dafault exit for any input. perhaps it is somethig to do with how php handles chars X strings? I don’t know.
Instead of switching the character itself, switch the character code. It’s dangerous to embed ASCII Extended characters directly in a string, raw. Sometimes even the editor you are using to write the code may save the characters incorrectly, if you have the wrong encoding specified.