Forum und email

mb_substr_count

(PHP 4 >= 4.3.0, PHP 5)

mb_substr_count — 部分文字列の出現回数を数える

説明

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

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

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

Example#1 mb_substr_count() の例

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

substr_count()mb_strpos()mb_substr() も参照ください。