成人精品一区二区三区中文字幕-成人精品一区二区三区-成人精品一级毛片-成人精品亚洲-日本在线视频一区二区-日本在线视频免费

導航首頁 ? 技術教程 ? PHP字符串函數count_chars()的用法
全站頭部文字 我要出現在這里
PHP字符串函數count_chars()的用法 771 2023-12-11   

count_chars

(PHP 4, PHP 5)

count_chars — 返回字符串所用字符的信息

說明

mixed count_chars ( string $string [, int $mode = 0 ] )

統計 string 中每個字節值(0..255)出現的次數,使用多種模式返回結果。

參數

string

需要統計的字符串。

mode

參見返回的值。

返回值

根據不同的 modecount_chars() 返回下列不同的結果: 0 - 以所有的每個字節值作為鍵名,出現次數作為值的數組。 1 - 與 0 相同,但只列出出現次數大于零的字節值。 2 - 與 0 相同,但只列出出現次數等于零的字節值。 3 - 返回由所有使用了的字節值組成的字符串。 4 - 返回由所有未使用的字節值組成的字符串。

范例

Example #1 count_chars() 示例

<?php
$data = "Two Ts and one F.";

foreach (count_chars($data, 1) as $i => $val) {
   echo "There were $val instance(s) of "" , chr($i) , "" in the string.n";
}
?>

以上例程會輸出:

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.

參見

strpos() - 查找字符串首次出現的位置 substr_count() - 計算字串出現的次數


主站蜘蛛池模板: 《致命弯道3》| 醒来的女人电影免费观看全集高清| 永远少年电影免费播放| 电影《斯大林格勒》| 小班安全开学第一课| 无锡电视台| 王兴德| 钱串子图片| 720lu在线观看| 忍之国| 家属动漫5| 张晋个人资料和简历| 学生早餐吃什么方便又营养| 同志电影副歌1080p| 霹霹乐翻天| 第一财经在线直播今日股市 | catastrophe翻译| 爱情电影片| 辰巳ゆい| 变形金刚7免费高清电影| 笼中鸟完整版| 江苏体育频道直播| 远方的故乡简谱| 香港之夜电影完整版在线播放| 散文诗二首批注| 济公斗蟋蟀| cctv6电影节目表| 无内女秘书| 职业探索怎么写| 外出韩版| 四大名著好词好句摘抄| 2024独一无二头像| 冒险王2| 实用咒语大全| 本溪电视台| 哈尔的移动城堡日语版在线播放| 美女亲热视频| 消防知识竞赛题库及答案| 歌手蔡国庆个人简历| 小春兰| 爱秀直播|

!!!站長長期在線接!!!

網站、小程序:定制開發/二次開發/仿制開發等

各種疑難雜癥解決/定制接口/定制采集等

站長微信:lxwl520520

站長QQ:1737366103