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

strstr

တစ် ဦး string ကို၏ပထမ ဦး ဆုံးဖြစ်ပျက်မှုကိုရှာပါ
အမည်:strstr
အမျိုးအစား:ကြိုး
programming language:php
တစ်ကြောင်းဖြင့်အကျဉ်းချုပ်:သတ်မှတ်ထားသောအလွှာကို string ကိုရှာဖွေပြီး stringstring ၏အဆုံးမှအပိုင်းကိုပြန်ပို့ပါ

function name: strstric ()

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

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

Syntax: strstrack (string $ haystack, ရောနှောထားသော $ အပ်, bool $ _needle = false): string |

Parametermer

  • Haystack: အလွှာကိုရှာဖွေရန်အတွက် string ကို။
  • အပ်: တွေ့ရှိရမည့်အလွှာ။ တစ် ဦး string ကိုသို့မဟုတ်ခင်းကျင်းနိုင်ပါတယ်။
  • Option_neade (optional) - အကယ်. မှန်ကန်ရန်သတ်မှတ်ထားပါကအပ်မတိုင်မီအပိုင်းကိုပြန်ပို့ပါ။ မှားယွင်းသော (ပုံမှန်) ကိုသတ်မှတ်ပါကအပ်ပြီးနောက်အပိုင်းကိုပြန်ပို့ပါ။

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

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

ဥပမာ -

 // 示例1:查找子字符串,并返回从子字符串开始到字符串结尾的部分$haystack = "Hello, world!"; $needle = "world"; $result = strstr($haystack, $needle); echo $result; // 输出:world! // 示例2:查找子字符串,并返回子字符串之前的部分$haystack = "Hello, world!"; $needle = ","; $result = strstr($haystack, $needle, true); echo $result; // 输出:Hello // 示例3:未找到子字符串,返回false $haystack = "Hello, world!"; $needle = "foo"; $result = strstr($haystack, $needle); var_dump($result); // 输出:bool(false)

မှတ်စုများ

  • ဒီ function ကိုစာလုံးအကြီးအသေးဖြစ်ပါတယ်။ အကယ်. သင်သည်ဖြစ်ရပ်မှန်အာရုံမခံစားနိုင်သောရှာဖွေမှုများကိုပြုလုပ်ရန်လိုအပ်ပါကသင်သည်မြောက်ကိုရီးယားကိုသုံးနိုင်သည်။
  • အကယ်. အပ်သည်ခင်းကျင်းပါက function သည် element တစ်ခုချင်းစီကိုရှာဖွေပြီးပထမ ဦး ဆုံးတွေ့ရှိသောအလွှာနှင့်၎င်း၏နောက်ဆက်တွဲအစိတ်အပိုင်းများကိုပြန်ပို့လိမ့်မည်။
  • PHP 8.0 ဖြင့်စတင်ခြင်းသည် Phat_neadele parameter သည်ပံ့ပိုးမှုမရှိတော့ပါ။ အကယ်. သင်သည်အလွှာမတိုင်မီအပိုင်းကိုပြန်ပို့ရန်လိုအပ်ပါက၎င်းကိုအကောင်အထည်ဖော်ရန် Substrict () function ကိုသုံးနိုင်သည်။
သက်ဆိုင်သောဖင်ခှ်ရှင်းများ
  • tag split string ကို strtok

    strtok

    tagsplitstringကို
  • အရှည်အတွက် string ကိုဖြည့်ရန်အခြား string ကိုသုံးပါ str_pad

    str_pad

    အရှည်အတွက်stringကိုဖ
  • ယုတ္တိဖြစ်သောဟေဗြဲဘာသာကို Visual-Hebrew သို့ပြောင်းရန်နှင့်အသစ်များပြောင်းလဲပါ hebrevc

    hebrevc

    ယုတ္တိဖြစ်သောဟေဗြဲဘာ
  • strstr ၏ alias ကို strchr

    strchr

    strstr၏aliasကို
  • တစ် ဦး string ကိုအပေါ်တစ် ဦး ပုပ် 1 နှစ်ပြောင်းလဲလုပ်ဆောင်ပါ str_rot13

    str_rot13

    တစ်ဦးstringကိုအပေါ်တ
  • အစားထိုး substring str_replace

    str_replace

    အစားထိုးsubstring
  • string တစ်ခုမှာပေးထားသောအလွှာတစ်ခုပါ 0 င်သည်ကိုဆုံးဖြတ်သည် str_contains

    str_contains

    stringတစ်ခုမှာပေးထား
  • ဇာတ်ကောင်တစ် ဦး အား Cyrillic ဇာတ်ကောင်တစ် ဦး မှအခြားတစ်ခုသို့ပြောင်းပါ convert_cyr_string

    convert_cyr_string

    ဇာတ်ကောင်တစ်ဦးအားCyr
လူကြိုက်များသော ဆောင်းပါးများ