1.chr — 返回指定的字符
参数
-
Ascii 码。
ascii
返回值
返回规定的字符。
范例
Example #1 chr() 例子
<?php
$str = "The string ends in escape: ";
$str .= chr(27); /* 在 $str 后边增加换码符 */
/* 通常这样更有用 */
$str = sprintf("The string ends in escape: %c", 27);
?>
参数
-
一个字符。
string
返回值
返回整型的 ASCII 码值。
范例
Example #1 ord() 范例
<?php
$str = "\n";
if (ord($str) == 10) {
echo "The first character of \$str is a line feed.\n";
}
?>