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);
Related labels:
source:php.cn
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
Group MySQL results by ID for looping over
I have a table with flight data in mysql. I'm writing a php code that will group and displ...
From 2024-04-06 17:27:56
0
1
406
Related Topics
More>
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
|