Below we give two examples, both of which use ord to judge character ascii to avoid the problem of Chinese garbled characters. For the function of this function, we can refer to http://www.bKjia.c0m/phper/php/41030. htm article, which gives a good introduction to the use of this function.
The code is as follows
|
Copy code
|
||||
//a character
$str=(pack("i", "100")); echo $str,"=",strlen($str),"byte n"; getascill($str); //s character short integer 2 bytes $str=(pack("s", "100")); echo $str,"=",strlen($str),"byte n"; getascill($str); //l character long integer 4 bytes $str=(pack("l", "100")); echo $str,"=",strlen($str),"byte n"; getascill($str);
Previous article:php empty() function in detail_PHP tutorial
Next article:Problem with garbled web pages when installing GBK encoding program in Apache environment under CentOS system_PHP tutorial
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
Latest Articles by Author
Latest Issues
When adding sublime3 to compile system php, use the PHP toolbox, cmd php -v is useless
From 1970-01-01 08:00:00
0
0
0
Related Topics
More>
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
|