英[ka?nt]? ?美[ka?nt]??

n.總數(shù);數(shù)數(shù);罪狀;論點

v.數(shù)數(shù);計算總數(shù);把…算入;重要

#第三人稱單數(shù): counts 複數(shù): counts 現(xiàn)在分詞: counting 過去式: counted 過去分詞: counted

php substr_count()函數(shù) 語法

作用:統(tǒng)計一個字串,在另一個字串中出現(xiàn)次數(shù)

語法:substr_count(string,substring,start,length)

參數(shù):

##描述## string? ??#。規(guī)定被檢查的字串。 substring? ??必要。規(guī)定要搜尋的字串。 start? ??可選。規(guī)定在字串中何處開始搜尋。 length? ??可選。規(guī)定搜尋的長度。??
參數(shù)

說明:
計算子字串在字串中出現(xiàn)的次數(shù)。子字串是區(qū)分大小寫的。此函數(shù)不計數(shù)重疊的子字串。如果?start?參數(shù)加上?length?參數(shù)大於字串長度,則函數(shù)產(chǎn)生一個警告。

###

php substr_count()函數(shù) 範(fàn)例

<?php
echo substr_count("I love php.I'm study in php.cn","php");
?>

運(yùn)行實例?

點擊"運(yùn)行實例"按鈕查看線上實例

輸出:

2
<?php
 $str = "This is php.cn test";
echo substr_count($str,"is",3,9);
?>

#運(yùn)行實例?

#點擊"運(yùn)行實例" 按鈕查看線上實例

輸出:

1