经测试代码如下:
/**
* 统计字符串单词数量
*
* @param
* @arrange (512.笔记) jb51.cc
**/
function word_count($sentence){
$array = explode(" ",$sentence);
return count($array);
}
$words = word_count("The is a group of words");
echo $words;
/*** 来自编程之家 jb51.cc(jb51.cc) ***/
原文链接:https://www.f2er.com/php/528982.html