Home  >  Article  >  Backend Development  >  What is the php utf8 conversion function?

What is the php utf8 conversion function?

藏色散人
藏色散人Original
2021-07-12 09:00:521526browse

php The utf8 conversion function is iconv, and the syntax for using this function is "string iconv (string in_charset, string out_charset, string str)".

What is the php utf8 conversion function?

The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer

What is the php utf8 conversion function?

string iconv ( string in_charset, string out_charset, string str )

Note: In addition to specifying the encoding to be converted to, the second parameter can also add two suffixes:

//TRANSLIT and //IGNORE, where //TRANSLIT will automatically The converted characters become one or more approximate characters. //IGNORE will ignore characters that cannot be converted, and the default effect is to truncate from the first illegal character.

Returns the converted string or FALSE on failure.

Example

GBK To UTF-8

$content = iconv("UTF-8", "GBK//IGNORE",$content);

Recommended study:《 PHP video tutorial

The above is the detailed content of What is the php utf8 conversion function?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn