utf8_encode() and utf8_decode function_PHP tutorial

WBOY
Release: 2016-07-13 10:54:18
Original
2092 people have browsed it

utf8_encode() function encodes an iso-8859-1 string into utf-8.

utf8_encode(string);
*/
$str="Hello, world!"; //Define string
$result=utf8_decode($str); //Convert encoding
echo $result; //Output the conversion result


//Example 2

/*
The utf8_decode() function decodes a utf-8 string into iso-8859-1.

This function converts an iso-8859-1 string encoded in utf-8 into a single-byte iso-8859-1 string.

If successful, this function returns the decoded string; otherwise it returns false.

utf8_decode(string)

*/

$str="hello world!"; //Define string
$result=utf8_decode($str); //Convert encoding
echo $result;
$result=utf8_encode($result); //Convert encoding
echo $result; //Output the conversion result
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632343.htmlTechArticleutf8_encode() function encodes the iso-8859-1 string into utf-8. utf8_encode(string); */ $str=Hello, world! ;//Define string $result=utf8_decode($str);//Convert encoding echo...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!