How to change a string to UTF8 in PHP?
In PHP, you can use the "iconv()" function to change the string to UTF8. The function of this function is to convert the string according to the required character encoding. Its syntax is "iconv(in, out,str)", when using it, set in to the encoding of the string, set out to UTF8, and set str to the string to be converted.
Conversion example
$str = "123456789"; $str = iconv('ASCII', 'UTF8', $str);
Usage example
Recommended tutorial: "PHP Tutorial"
The above is the detailed content of How to change string to UTF8 in PHP?. For more information, please follow other related articles on the PHP Chinese website!