开发者

Convert special characters to normal characters using PHP, like ã, é, ç to a, e, c [closed]

开发者 https://www.devze.com 2023-02-01 00:35 出处:网络
开发者_如何学运维 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current for
开发者_如何学运维 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 12 years ago.

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.


$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.

0

精彩评论

暂无评论...
验证码 换一张
取 消