ord函数 chr函数
PHP chr()函数 (PHP chr() function)
chr() functionis used to get the character from a given ASCII code. ASCII value can be in decimal format, octal format by following 0 (zero), and hexadecimal format by following 0x.
chr()函数用于从给定的ASCII码获取字符。 ASCII值可以是十进制格式,八进制格式(跟随0 (零))和十六进制格式(跟随0x) 。
Syntax:
句法:
chr(ASCII_value);
Function accepts ASCII value in number and returns corresponding character.
函数接受数字形式的ASCII值并返回相应的字符。
Examples:
例子:
Input: 65Output: 'A'Input: 0x41Output: 'A'
PHP code:
PHP代码:
<?phpecho (chr(65)."\n"); //ASCII value of 'A' in decimalecho (chr(0101)."\n"); //ASCII value of 'A' in octalecho (chr(0x41)."\n"); //ASCII value of 'A' in hex?>
Output
输出量
AAA
翻译自: /php/chr-function-with-example.aspx
ord函数 chr函数