英[ka?nt]? ?美[ka?nt]??
n.總數(shù);數(shù)數(shù);罪狀;論點(diǎn)
v.數(shù)數(shù);計(jì)算總數(shù);把…算入;重要
#第三人稱單數(shù): counts 複數(shù): counts 現(xiàn)在分詞: counting 過(guò)去式: counted 過(guò)去分詞: counted
php substr_count()函數(shù) 語(yǔ)法
作用:統(tǒng)計(jì)一個(gè)字串,在另一個(gè)字串中出現(xiàn)次數(shù)
語(yǔ)法:substr_count(string,substring,start,length)
參數(shù):
參數(shù) | ##描述|
## string? ?? | #。規(guī)定被檢查的字串。 |
substring? ?? | 必要。規(guī)定要搜尋的字串。 |
start? ?? | 可選。規(guī)定在字串中何處開始搜尋。 |
length? ?? | 可選。規(guī)定搜尋的長(zhǎng)度。?? |
說(shuō)明:
計(jì)算子字串在字串中出現(xiàn)的次數(shù)。子字串是區(qū)分大小寫的。此函數(shù)不計(jì)數(shù)重疊的子字串。如果?start?參數(shù)加上?length?參數(shù)大於字串長(zhǎng)度,則函數(shù)產(chǎn)生一個(gè)警告。
php substr_count()函數(shù) 範(fàn)例
<?php echo substr_count("I love php.I'm study in php.cn","php"); ?>
運(yùn)行實(shí)例?
點(diǎn)擊"運(yùn)行實(shí)例"按鈕查看線上實(shí)例
輸出:
2
<?php $str = "This is php.cn test"; echo substr_count($str,"is",3,9); ?>
#運(yùn)行實(shí)例?
#點(diǎn)擊"運(yùn)行實(shí)例" 按鈕查看線上實(shí)例
輸出:
1