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

n.總數;數數;罪狀;論點

v.數數;計算總數;把…算入;重要

#第三人稱單數: counts 複數: counts 現在分詞: counting 過去式: counted 過去分詞: counted

php substr_count()函數 語法

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

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

參數:

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

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

###

php substr_count()函數 範例

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

運行實例?

點擊"運行實例"按鈕查看線上實例

輸出:

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

#運行實例?

#點擊"運行實例" 按鈕查看線上實例

輸出:

1