downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

mb_substr> <mb_substitute_character
[edit] Last updated: Fri, 25 May 2012

view this page in

mb_substr_count

(PHP 4 >= 4.3.0, PHP 5)

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

説明

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

文字列 haystack の中での部分文字列 needle の出現回数を数えます。

パラメータ

haystack

調べたい文字列。

needle

見つける文字列。

encoding

encoding パラメータには文字エンコーディングを指定します。省略した場合は、 内部文字エンコーディングを使用します。

返り値

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

例1 mb_substr_count() の例

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

参考

  • mb_strpos() - 文字列の中に指定した文字列が最初に現れる位置を見つける
  • mb_substr() - 文字列の一部を得る
  • substr_count() - 副文字列の出現回数を数える



add a note add a note User Contributed Notes mb_substr_count
There are no user contributed notes for this page.

 
show source | credits | sitemap | contact | advertising | mirror sites