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

explode

အခြား string တစ်ခုသို့ array သို့ခွဲရန် string တစ်ခုကိုသုံးပါ
အမည်:explode
အမျိုးအစား:ကြိုး
programming language:php
တစ်ကြောင်းဖြင့်အကျဉ်းချုပ်:string ကို array သို့ချိုးဖျက်။

အဓိပ္ပါယ်နှင့်အသုံးပြုမှု

explode() function ကို array သို့ string ကိုချိုးဖျက်။

မှတ်ချက် - " Separator " parameter သည်အချည်းနှီးသောကြိုးမဖြစ်နိုင်ပါ။

မှတ်ချက် - ဒီ function က binary ဘေးကင်းလုံခြုံသည်။

နမူနာ

ဥပမာ 1

strings တွေကို arrays သို့ချိုးဖျက်

 <? PHP
$ str = "ဟဲလိုကမ္ဘာ။ ငါရှန်ဟိုင်းကိုချစ်!" ;
Print_r ( exploit ( "" , $ str ) ) ;
>

သင်ကိုယ်တိုင်စမ်းကြည့်ပါ

ဥပမာ 2

အချို့သော Array element များကိုပြန်ပို့ရန်က န့်သတ် parameter ကိုသုံးပါ။

 <? PHP
$ str = 'တ ဦး တည်း, သုံး, သုံး, လေး " ;

// သုညက န့်သတ်
Print_r ( exploit ( ',', ' , $ str , 0 ) ;

// အပြုသဘော ကန့်သတ်
Print_r ( exploit ( ',', ' , ', $ str , 2 ) ) ;

// အနုတ်လက်ခဏာက န့်သတ်ချက်
Print_r ( exploit ( ',', ' , $ str , - 1 ) ) ;
>

သင်ကိုယ်တိုင်စမ်းကြည့်ပါ

သဒ္ဒါ

 Exploit ( Separator , String , ကန့်သတ်ချက် )
တေးရေး ဖေါ်ပြ
ပင်ဆိုတာ လိုအပ်ပါတယ် strings ကို split ရန်နေရာကိုသတ်မှတ်ပါတယ်။
ကြိုး လိုအပ်ပါတယ် split ခံရဖို့ string ကို။
ကန့်သတ်

optional ကို။ ပြန်လာသောခင်းကျင်းဒြပ်စင်အရေအတွက်ကိုသတ်မှတ်သည်။

ဖြစ်နိုင်သောတန်ဖိုးများ:

  • 0 ထက်ကြီး - ဒြပ်စင်များကိုက န့်သတ်ရန်အတွက် ပါ 0 င်သည့်ခင်းကျင်းမှုကိုပြန်လည်ရောက်ရှိစေသည်
  • 0 ထက်နည်းသည် - နောက်ဆုံး - ကန့ ်သတ် ချက် မှလွဲ. ဒြပ်စင်များပါ 0 င်သည့်နေရာများပါ 0 င်သည်
  • 0 - Element တစ်ခုပါ 0 င်သည့်နေရာတစ်ခုကိုပြန်ပို့ပါ
သက်ဆိုင်သောဖင်ခှ်ရှင်းများ
  • C startion တွင် backslashes ကို အသုံးပြု. string တစ်ခုအတွက်ဇာတ်ကောင်များလွတ်မြောက်ခြင်း addcslashes

    addcslashes

    Cstartionတွင်backsla
  • ဒီဂျစ်တယ် format အချက်အလက်ကိုရယူပါ localeconv

    localeconv

    ဒီဂျစ်တယ်formatအချက်
  • Metacharacter အစုံလွတ်မြောက် quotemeta

    quotemeta

    Metacharacterအစုံလွတ
  • output ကို format ချ string ကို vprintf

    vprintf

    outputကိုformatချstr
  • string ကိုပြန်လုပ်ပါ str_repeat

    str_repeat

    stringကိုပြန်လုပ်ပါ
  • မျိုးစုံ variable တွေကိုသို့ parse strings parse_str

    parse_str

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

    convert_cyr_string

    ဇာတ်ကောင်တစ်ဦးအားCyr
  • string ၏အဆုံးမှာ whitespace ဇာတ်ကောင် (သို့မဟုတ်အခြားဇာတ်ကောင်) ကိုဖျက်ပါ rtrim

    rtrim

    string၏အဆုံးမှာwhite
လူကြိုက်များသော ဆောင်းပါးများ