function make_ascii($str) {
$special = array('ľ','š','č','ť','ž','ý','á','í','é','ú','ä','ô','ň','ě');
$ascii = array('l','s','c','t','z','y','a','i','e','u','a','o','n','e');
$str = str_split($str);
foreach ($str as $k => $c) {
if(ctype_upper($c)) {
$u = true;
$c = strtolower($c);
} else {
$u = false;
}
if(in_array($c, $special, false)) {
$c = $ascii[array_search($c, $special)];
}
if($u) {
$c = strtoupper($c);
}
$str[$k] = $c;
}
return join($str);
}
In this function, even if I feed characters from $special
array the in_array()
returns false every time, if I would var_dump()
on regular text I try to parse, the output will be just bool(false)
with no mach, even if I copy paste the character from source to array. Also I'm looking for way to make this character replacement work.