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

mb_strstr

အခြား string တစ်ခုအတွက် string ကို၏ပထမ ဦး ဆုံးဖြစ်ပျက်မှုကိုရှာပါ
အမည်:mb_strstr
အမျိုးအစား:Multi-byte string ကို
programming language:php
တစ်ကြောင်းဖြင့်အကျဉ်းချုပ်:$ haystack အတွက် $ haystack တွင် substring ကိုရှာဖွေခြင်းနှင့် $ အပ်ပြီးနောက် string ၏အစိတ်အပိုင်းကိုပြန်ပို့ပါ

function name: mb_strstrstric ()

သက်ဆိုင်သောဗားရှင်း - PHP 4> = 4.0.6, PHP 5, PHP 7, PHP 8

အသုံးပြုမှု: MB_Strstrtrcrcrcrcre (string $ haystack, string ကို $ အပ်, bool $ _needle = false, string $ encoding = null): string |

ဖော်ပြချက် - MB_Strstrstrcr () function ကို string ကို $ haystack တွင်အလွှာအလွှာကိုရှာဖွေရန်နှင့် $ အပ်ပြီးနောက် string ကိုပြန်ပို့ရန်အသုံးပြုသည်။ ဤလုပ်ဆောင်ချက်သည်ဇာတိ strstred () function နှင့်ဆင်တူသော်လည်း Multibyte ဇာတ်ကောင်အစုံများကိုလည်းထောက်ပံ့သည်။

Parametermer

  • $ haystack: အလွှာကိုရှာဖွေရန်မူရင်း string ကို။
  • $ အပ် - တွေ့ရှိရမည့်အလွှာ။
  • $ Option_needle (optional) - အကယ်. စစ်မှန်သောအနေဖြင့်မှန်ကန်ပါက $ အပ်မတိုင်မီတစ်စိတ်တစ်ပိုင်း string ကိုပြန်ပို့ပါ။
  • $ encoding (optional ကို): ဇာတ်ကောင် encoding ကိုသတ်မှတ်ပါ။ မသတ်မှတ်ပါကအတွင်းပိုင်းဇာတ်ကောင် encoding ကိုအသုံးပြုသည်။

Value ကိုပြန်သွားပါ

  • အကယ်. $ အပ်ကိုရှာတွေ့လျှင် $ အပ်ပြီးနောက်တစ်စိတ်တစ်ပိုင်း string ကိုပြန်ပို့သည်။
  • $ အပ်ကိုရှာမတွေ့ပါကမှားယွင်းသောပြန်လာသည်။

ဥပမာ -

 $str = "Hello, World!"; $needle = "World"; // 在$str 中查找$needle 并返回$needle 后的部分字符串$result = mb_strstr($str, $needle); echo $result; // 输出: World! // 在$str 中查找$needle 并返回$needle 之前的部分字符串$result = mb_strstr($str, $needle, true); echo $result; // 输出: Hello, // 使用指定的字符编码进行查找$str = "你好,世界!"; $needle = "世界"; $result = mb_strstr($str, $needle, false, 'UTF-8'); echo $result; // 输出: 世界!

မှတ်စုများ

  • အကယ်. $ encoding parameter သည်မကိုက်ညီပါက, Internal character encoding ကိုပုံမှန်အားဖြင့်အသုံးပြုသည်။ အသုံးမပြုမီမှန်ကန်သောဇာတ်ကောင် encoding ကိုသတ်မှတ်ရန်အကြံပြုသည်။
  • သင်ရှာဖွေနေသည့်အလွှာသည်အချည်းနှီးသော string တစ်ခုဖြစ်ပါကမူရင်း string ကိုပြန်ပို့သည်။
  • mb_strstrcrcrecr () function သည်စာလုံးအကြီးအသေးအရေးကြီးသည်။ သင်ဖြစ်ရပ်အာရုံမခံစားနိုင်သောရှာဖွေမှုတစ်ခုကိုပြုလုပ်လိုပါက MB_Stropos () function ကိုသုံးနိုင်သည်။
သက်ဆိုင်သောဖင်ခှ်ရှင်းများ
  • Mbstring ၏အတွင်းပိုင်း settings ကိုရယူပါ mb_get_info

    mb_get_info

    Mbstring၏အတွင်းပိုင်
  • Multi-byte ပုံမှန် prefefined Multi-byte strings များအတွက်ကိုက်ညီမှုကိုက်ညီ mb_ereg_search

    mb_ereg_search

    Multi-byteပုံမှန်pre
  • အခြားရွေးချယ်စရာဇာတ်ကောင်များကိုသတ်မှတ်ပါ mb_substitute_character

    mb_substitute_character

    အခြားရွေးချယ်စရာဇာတ်
  • သတ်သတ်မှတ်မှတ်စာလုံးများရယူပါ mb_chr

    mb_chr

    သတ်သတ်မှတ်မှတ်စာလုံး
  • ဇာတ်ကောင်၏ကုဒ်အမှတ်ကိုရယူပါ mb_ord

    mb_ord

    ဇာတ်ကောင်၏ကုဒ်အမှတ်က
  • အက်ခရာ encoding ၏ရှာဖွေတွေ့ရှိအမိန့်ကို set / ရယူပါ mb_detect_order

    mb_detect_order

    အက်ခရာencoding၏ရှာဖွ
  • substring များ၏ကွိ၏အရေအတွက်ကိုတွက်ချက် mb_substr_count

    mb_substr_count

    substringများ၏ကွိ၏အရ
  • MBREGEX လုပ်ဆောင်ချက်များအတွက် default options များကိုသတ်မှတ်ပါ mb_regex_set_options

    mb_regex_set_options

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