mb_substr_count
(PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8)
mb_substr_count — 統計字串出現的次數
說明
   mb_substr_count(string 
  $haystack, string $needle, string $encoding = mb_internal_encoding()): int
   統計子字串 needle 出現在字串 haystack 中的次數。
  
參數
- 
haystack
- 
      要檢查的字串。 
- 
needle
- 
      待查詢的字串。 
- 
encoding
- 
      encoding參數為字元編碼。如果省略或是null,則使用內部字元編碼。
返回值
   子字串 needle 出現在字串 haystack 中的次數。
  
範例
示例 #1 mb_substr_count() 例子
<?php
echo mb_substr_count("This is a test", "is"); // 輸出 2
?>