函数名 | 返回值类型 | 描述 | |
count_chars | mixed | 返回字符串所用字符的信息 | |
参数名 | 数据类型 | 是否必须 | 备注 |
$string | string | 必须 | 字符串 |
$mode | int | 可空 默认值:0 | 整数型 |
统计 string 中每个字节值(0..255)出现的次数,使用多种模式返回结果。
需要统计的字符串。
参见返回的值。
根据不同的 mode, count_chars() 返回下列不同的结果:
Example #1 count_chars() 示例
以上例程会输出:
There were 4 instance(s) of " " in the string. There were 1 instance(s) of "." in the string. There were 1 instance(s) of "F" in the string. There were 2 instance(s) of "T" in the string. There were 1 instance(s) of "a" in the string. There were 1 instance(s) of "d" in the string. There were 1 instance(s) of "e" in the string. There were 2 instance(s) of "n" in the string. There were 2 instance(s) of "o" in the string. There were 1 instance(s) of "s" in the string. There were 1 instance(s) of "w" in the string.
函数名 | 函数简介 |
addcslashes | 以 C 语言风格使用反斜线转义字符串中的字符 |
addslashes | 使用反斜线引用字符串 |
bin2hex | 函数把ASCII字符的字符串转换为十六进制值 |
chop | rtrim 的别名 |
chr | 返回指定的字符 |
chunk_split | 将字符串分割成小块 |
convert_cyr_string | 将字符由一种 Cyrillic 字符转换成另一种 |
convert_uudecode | 解码一个 uuencode 编码的字符串 |
convert_uuencode | 使用 uuencode 编码一个字符串 |
count_chars | 返回字符串所用字符的信息 |
crc32 | 计算一个字符串的 crc32 多项式 |
crypt | 单向字符串散列 |
echo | 输出一个或多个字符串 |
explode | 使用一个字符串分割另一个字符串 |
fprintf | 将格式化后的字符串写入到流 |