လက်ရှိတည်နေရာ: ပင်မစာမျက်နှာ> ဖန်ရှင်အမျိုးအစားများ> mb_substr_count

mb_substr_count

substring များ၏ကွိ၏အရေအတွက်ကိုတွက်ချက်
အမည်:mb_substr_count
အမျိုးအစား:Multi-byte string ကို
programming language:php
တစ်ကြောင်းဖြင့်အကျဉ်းချုပ်:အခြား string တစ်ခုတွင် string ကိုတွက်ချက်သည့်အကြိမ်အရေအတွက်ကိုတွက်ချက်ပါ

function name: mb_substr_count ()

function ကိုဖော်ပြချက် - MB_Substr_count () function ကိုအခြား string တစ်ခုတွင် string တစ်ခုပေါ်လာသည့်အကြိမ်အရေအတွက်ကိုတွက်ချက်ရန်အသုံးပြုသည်။

function ကိုအသုံးပြုမှု: mb_substr_count (string $ haystack, string string ကို string ကို, string ကို | NULL $ encoding = null): null $ encoding = NULL

Parametermer

  • $ haystack: လိုအပ်, ရှာဖွေရန် string ကို။
  • $ အပ် - လိုအပ်သည်, ရှာဖွေရန်အလွှာ။
  • $ encoding: optional ကို encoding ကိုသတ်မှတ်ပါ။ default သည်အတွင်းပိုင်းဇာတ်ကောင် encoding ဖြစ်သည်။

Return Value: string တွင်အလွှာတစ်ခုပေါ်လာသည့်အကြိမ်အရေအတွက်ကိုပြန်ပို့ပါ။

ဥပမာ -

 $text = "Hello, I'm a PHP developer."; $substring = "php"; $count = mb_substr_count(mb_strtolower($text), mb_strtolower($substring)); echo "子字符串出现的次数为: " . $count;

output: substring ပေါ်လာသည့်အကြိမ်အရေအတွက် - 1

ဖော်ပြချက် - အထက်ဖော်ပြပါဥပမာတွင် PHP မှ "PHP" တွင် "PHP" တွင်ဖော်ပြထားသောအကြိမ်အရေအတွက်ကိုတွက်ချက်ရန် MB_substr_Count () function ကိုအသုံးပြုခဲ့သည်။ function ကိုအနှောင့်အယှက်မဖြစ်စေနိုင်သောကြောင့်ကျွန်ုပ်တို့သည် string ကိုတွက်ချက်ခြင်းမပြုမီစာလုံးအသေးများကိုပြောင်းလဲရန် MB_Strostollower () function ကိုအသုံးပြုခဲ့သည်။ နောက်ဆုံးအနေဖြင့်ကျွန်ုပ်တို့သည်တွက်ချက်မှုရလဒ်ကို "အလွှာ၏အကြိမ်အရေအတွက်သည် 1" ဟုဆိုသည်။

သက်ဆိုင်သောဖင်ခှ်ရှင်းများ
လူကြိုက်များသော ဆောင်းပါးများ