php统计字符串单词数量
php统计字符串单词数量 ```{php}lt;?php function word_count($sentence){ $array = explode(quot; quot;, $sentence); return count($array); } $words = word_count(quot;The is a group of wordsquot;);
<?php function word_count($sentence){ $array = explode(" ", $sentence); return count($array); } $words = word_count("The is a group of words"); echo $words; ?>
- 上一篇:PHP查看数据库表结构
- 下一篇:UBB 转换ubb代码的一个函数
精彩图集
精彩文章