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

mb_split

ပုံမှန်အသုံးအနှုန်းတွေကိုအသုံးပြုပြီး Multibyte strings ကွဲခြင်း
အမည်:mb_split
အမျိုးအစား:Multi-byte string ကို
programming language:php
တစ်ကြောင်းဖြင့်အကျဉ်းချုပ်:string ကို segment အတွက် segment အတွက် set ကို သုံး. segmented substrings တစ်ခုခင်းကျင်းခြင်း

function name: mb_split ()

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

function ကိုဖော်ပြချက် - MB_SPLIT () function သည် strings သည် strings များကို ခွဲ. splited substring များဖြင့်ရေးထားသောခင်းပိတ်တစ်ခုသို့ထည့်သွင်းရန်စီစဉ်ထားသည်။

Syntax: MB_SPLIT (string $ ပုံစံ, string ကို $ string [int $ ကန့်သတ် = -1])

Parametermer

  • $ ပုံစံ - သတ်မှတ်ထားသော delimiter, string တစ်ခုသို့မဟုတ်ပုံမှန်စကားရပ်ဖြစ်နိုင်သည်။
  • $ string: split ခံရဖို့ string ကို။
  • $ ကန့်သတ်ချက် (optional) - ခင်းကျင်းရန်အမြင့်ဆုံးဒြပ်စင်အများဆုံးအရေအတွက်ကိုသတ်မှတ်ပါ။ ပုံမှန်တန်ဖိုးသည် -1 သည် Returned Array elements အရေအတွက်ကိုအကန့်အသတ်မရှိကြောင်းညွှန်ပြသည်။

Reward Value: ကွဲပြားမှုအလွှာများရေးစပ်ထားသည့်ခင်းကျင်းမှုတစ်ခုသို့ပြန်လည်ရောက်ရှိလာပြီးကွဲသွားသည်ဆိုလျှင်မှားယွင်းစွာပြန်ပို့သည်။

ဥပမာ -

 // 使用空格分割字符串$str = "Hello World"; $result = mb_split(" ", $str); print_r($result); // Output: Array ( [0] => Hello [1] => World ) // 使用正则表达式分割字符串$str = "Hello,World"; $result = mb_split("[,]", $str); print_r($result); // Output: Array ( [0] => Hello [1] => World ) // 限制返回的数组元素个数$str = "Hello World"; $result = mb_split(" ", $str, 1); print_r($result); // Output: Array ( [0] => Hello )

မှတ်စုများ

  • MB_Split () function သည် segmentation အတွက် Multibyte ဇာတ်ကောင်ကိုအသုံးပြုသည်။ PHP ပတ်ဝန်းကျင်တွင် Mbstring extension ကိုဖွင့်ထားရန်လိုအပ်သည်။
  • အကယ်. split မအောင်မြင်ပါက MB_SPLIT () function သည်မှားယွင်းသောအရာဖြစ်သည်။
  • အကယ်. $ ကန့်သတ် parameter သည်မသတ်မှတ်ထားပါကခွဲထွက် substrings အားလုံးကိုပြန်လည်ပေးပို့လိမ့်မည်။
သက်ဆိုင်သောဖင်ခှ်ရှင်းများ
လူကြိုက်များသော ဆောင်းပါးများ