PHP  
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
search for in the  
<chopchunk_split>
Last updated: Mon, 16 Jul 2012

chr

(PHP 3, PHP 4, PHP 5)

chr -- 返回指定的字符

描述

string chr ( int ascii )

返回相对应于 ascii 所指定的单个字符。

例子 1. chr() 示例

<?php
$str
= "The string ends in escape: ";
$str .= chr(27); /* 在 $str 后边增加换码符 */

/* 通常这样更有用 */

$str = sprintf("The string ends in escape: %c", 27);
?>

你可以在此处找到 ASCII 码表:http://www.asciitable.com

此函数与 ord() 是互补的。参见 sprintf() 如何使用格式字符串 %c




<chopchunk_split>
 Last updated: Mon, 16 Jul 2012
 
Copyright © 2001-2005 The PHP Group
All rights reserved.
This unofficial mirror is operated at: http://manual.phpv.net/
Last updated: Thu Jul 7 19:13:47 2005 CST