I have a form where the user enters Greek script (unicode) and the php script then tries to convert this into the latin alpabet so users can tell how to pronounce the word.
A particular rule that I have to implement is the following: If a string contains the Greek characters "??" then I need to find what the next character is so I can convert it correctly. If it is an "?" then the "??" needs to be converted to "ef", if not then it converts to an "ev".
I've tried doing the code I've posted in below, but whilst the script works when I'm debugging in my editor, it doesn't when running it from my browser. Hence, I'm looking for an alternative that doesn't use mb_substr() as that is the routine that is not working consistently for me.
Code: Select all
$input = "?????????";
$pos = mb_strpos($input, "??");
if ($pos >= 0)
{
$NextLetter = mb_substr($input, $pos + 2, 1);
}
if ($NextLetter == "?")
{
$input = mb_ereg_replace("??", "ef", $input);
}
else
{
$input = mb_ereg_replace("??", "ev", $input);
}
Tim.