How to replace accented characters with PHP?

Spread the love

Sometimes, we want to replace accented characters with PHP.

In this article, we’ll look at how to replace accented characters with PHP.

How to replace accented characters with PHP?

To replace accented characters with PHP, we can use the iconv function.

For instance, we write

$val = iconv("ISO-8859-1", "ASCII//TRANSLIT", $val);

to call iconv with "ISO-8859-1", "ASCII//TRANSLIT", and $val to return a new string with the diacritics in $val removed.

Conclusion

To replace accented characters with PHP, we can use the iconv function.

Leave a Reply

Your email address will not be published.