Today, I wrote a paragraph according to the book.CodeThe purpose of the code is to split the string into Arrays Using the str_split () function. It is easy to say in English, but there is a problem when splitting the Chinese character (two Chinese characters and one array unit --
Check the Code:
<! Doctype HTML public "-// W3C // dtd html 4.01 transitional // en" "http://www.w3.org/TR/html4/loose.dtd" >
< Html >
< Head >
< Meta HTTP-equiv = "Content-Type" Content = "Text/html; charsets = UTF-8" />
< Title > New Document </ Title >
< Meta Name = "Author" Content = "" />
< Meta Name = "Keywords" Content = "" />
< Meta Name = "Description" Content = "" />
< Link REL = "Stylesheet" Type = "Text/CSS" Href = "" />
</ Head >
< Body >
<? PHP
$ String1 = "I Am a phper ";
$ String2 = "This book is a blue ocean strategy ";
Print_r (str_split ($ string1 ));
Echo "<br/> ";
Print_r (str_split ($ string2, 4 ));
?>
</ Body >
</ Html >
Test result output as expected --Chinese garbled characters
Why? Why? Why? Why? What is garbled code? What is garbled? Explain to me what is % & garbled!
Because English without garbled characters, only Chinese garbled characters, first of all think of the encoding problem, so suddenly think of the UTF-8 encoding is UTF-8 needs 3 bytes, dead horse as a doctor!
Therefore, print_r (str_split ($ string2, 4); 4 in this sentence is replaced6, So -- view the result
Similarly, you can also try to change the UTF-8 of charset encoding to gb2312, because unicode encoding requires 2 bytes, so the gb2312 encoding can save 1/3 of the space than the UTF-8, but if you want to be compatible with other languages of Traditional Chinese, Korean, and Japanese, you need to use UTF-8.
By the way, I found the first dynamic music and shared it with me:
-It's OK?
-It's OK!