龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > web编程 > php编程 >

php统计字符串单词数量

时间:2014-06-25 02:16来源:网络整理 作者:网络 点击:
分享到:
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; 
?>
精彩图集

赞助商链接