mb_substr_count

(PHP 4 >= 4.3.0)

mb_substr_count -- 副文字列の出現関数を数える

説明

int mb_substr_count ( string haystack, string needle [, string encoding])

substr_count()は、文字列 haystackの中での副文字列 needleの出現回数を返します。

encoding は、 needlehaystack に対する 文字エンコーディングを指定します。省略された場合は、 内部文字エンコーディングが使用されます。

例 1mb_substr_count()の例

<?php
print mb_substr_count("これはてすとです。", "す"); // 2 を出力する
?>

substr_count(), mb_strpos(), mb_substr() も参照下さい。