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_substr_count
There are no user contributed notes for this page.
