欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

php實(shí)現(xiàn)的統(tǒng)計(jì)字?jǐn)?shù)函數(shù)定義與使用示例

 更新時(shí)間:2017年07月26日 11:45:02   作者:LoveJulin  
這篇文章主要介紹了php實(shí)現(xiàn)的統(tǒng)計(jì)字?jǐn)?shù)函數(shù)定義與使用方法,結(jié)合實(shí)例形式分析了php針對(duì)字符串的統(tǒng)計(jì)運(yùn)算相關(guān)操作技巧,需要的朋友可以參考下

本文實(shí)例講述了php實(shí)現(xiàn)的統(tǒng)計(jì)字?jǐn)?shù)函數(shù)定義與使用方法。分享給大家供大家參考,具體如下:

<?php
//函數(shù)定義:
function countWords($str){
  echo (mb_strlen($str, 'utf8') + strlen($str))/2;
}
//使用方法:
$strdemo1='歡迎訪問腳本之家';
$strdemo2='http://www.dbjr.com.cn';
$strdemo3='歡迎訪問腳本之家http://www.dbjr.com.cn';
countWords($strdemo1);
echo "<br/>";
countWords($strdemo2);
echo "<br/>";
countWords($strdemo3);
?>

運(yùn)行結(jié)果:

16
19
35

PS:這里再為大家推薦2款非常方便的統(tǒng)計(jì)工具供大家參考使用:

在線字?jǐn)?shù)統(tǒng)計(jì)工具:
http://tools.jb51.net/code/zishutongji

在線字符統(tǒng)計(jì)與編輯工具:
http://tools.jb51.net/code/char_tongji

更多關(guān)于PHP相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《php常用函數(shù)與技巧總結(jié)》、《php字符串(string)用法總結(jié)》、《PHP數(shù)組(Array)操作技巧大全》、《PHP基本語(yǔ)法入門教程》、《php+mysql數(shù)據(jù)庫(kù)操作入門教程》及《php常見數(shù)據(jù)庫(kù)操作技巧匯總

希望本文所述對(duì)大家PHP程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論