The functions of these two functions are exactly opposite. The chr function returns the character from the specified ASCII value and the ord() function returns the ASCII value of the first character of the string. If you understand this, you will be able to use this function.
Look at the chr function first
chr() function returns characters from the specified ASCII value.
chr(ascii)
ascii argument can be decimal, octal or hexadecimal. Specify octal by leading 0, specify hexadecimal by leading 0x
Example
The code is as follows | Copy code | ||||||||||||||||||||||||
?>Output: 4 *R Isn’t it amazing? In fact, it’s not surprising that I often use chr to operate some invisible codes, such as Think about this What will be output? The result is
Let’s look at the ord function
Previous article:PHP Chinese character conversion pinyin implementation program_PHP tutorial
Next article:Implementation code for operating json format data conversion in PHP_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>
|