3

I would like to convert special characters to normal characters using PHP.

For example.

ã, á, à, é, ç, ...

to

a, a, a, e, c, ...

It would be great if someone could help me with the issue I'm having.

Tim Visée
  • 2,988
  • 4
  • 45
  • 55
user516957
  • 67
  • 2
  • 7

1 Answers1

5
$ts = array("/[À-Å]/","/Æ/","/Ç/","/[È-Ë]/","/[Ì-Ï]/","/Ð/","/Ñ/","/[Ò-ÖØ]/","/×/","/[Ù-Ü]/","/[Ý-ß]/","/[à-å]/","/æ/","/ç/","/[è-ë]/","/[ì-ï]/","/ð/","/ñ/","/[ò-öø]/","/÷/","/[ù-ü]/","/[ý-ÿ]/");
$tn = array("A","AE","C","E","I","D","N","O","X","U","Y","a","ae","c","e","i","d","n","o","x","u","y");
preg_replace($ts,$tn, $p);

Make an array of the special characters and an array of the regular character and use preg_replace() on the string like above.

Will
  • 19,661
  • 7
  • 47
  • 48
  • i wanna to know how to covert special character string like â ëåñó ðîäèëàñü åëî÷êà in php – user516957 Dec 22 '10 at 16:25