-1

How would I go about converting foreign characters to english characters?

David
  • 188,958
  • 33
  • 188
  • 262
HELP
  • 13,677
  • 19
  • 63
  • 100

3 Answers3

2

Mapping them:

$map = array(
    'รก' => 'a',
    'e' => 'e',
// ...
);

$text = str_replace(array_keys($map), array_values($map), $text);
ssice
  • 3,434
  • 1
  • 28
  • 41
2

PHP has strtr() that can achieve this. Read more here

The first entry under User Contributed Notes has something that should help you

Community
  • 1
  • 1
Chris Ghenea
  • 11,443
  • 1
  • 28
  • 36
0

create an character mapping array with element format: foreign characters => english characters
and replace string with all array element.

erinus
  • 714
  • 4
  • 5