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

natcasesort

Array Case-Malensitive အက္ခရာများကို sort လုပ်ရန် "သဘာဝ sorting" algorithm ကိုသုံးပါ
အမည်:natcasesort
အမျိုးအစား:အခင်းအကျင်း
programming language:php
တစ်ကြောင်းဖြင့်အကျဉ်းချုပ်:Arrays ကိုအာရုံစူးစိုက်ရန် "သဘာဝ sort" algorithm ကိုသုံးပါ။

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

natcasesort() function ကိုသည် "သဘာဝ sort" algorithm ကိုအသုံးပြုသည်။ အဓိကတန်ဖိုးများသည်သူတို့၏မူလသော့ချက်အမည်များကိုဆက်လက်ထိန်းသိမ်းထားသည်။

သဘာဝအနေဖြင့်နံပါတ် 2 သည်နံပါတ် 2 သည်နံပါတ် 10 ထက်နည်းသည်။ Computer sorting algorithms တွင် 10 ခုထက်နည်းသောကြောင့် 2 နှစ်အောက်ဖြစ်သည်။

ဒီ function ကိုဖြစ်ရပ်မှန် - အာရုံမခံစားနိုင်ပါ။

အောင်မြင်ပါက function သည်မှန်ကန်သည်။ မအောင်မြင်ပါကမှားယွင်းစွာပြန်ပို့သည်။

နမူနာ

 <? PHP
$ temp_files = array ( temp15.txt " , " Temp10.txt " ,
"Temp2.txt" , "Temp22.txt" , "Temp2.txt" ) ;

Natsort ( $ temp_files ) ;
Echo "သဘာဝ sorting:" ;
Print_r ( $ temp_files ) ;
echo "<br />" ;

natcaseort ( $ temp_files ) ;
ECHO "Caster-insensive Nature Sorting:" ;
Print_r ( $ temp_files ) ;
>

အထက်ပါကုဒ် output ကို:

 သဘာဝ sort:

အခင်းအကျင်း
(
[0] => temp10.txt
[1] => temp22.txt
[2] => temp1.txt
[4] => temp2.txt
[3] => temp15.txt
)

အရေးပါသောအမှု၌သဘာဝအမိန့်:

အခင်းအကျင်း
(
[2] => temp1.txt
[4] => temp2.txt
[0] => temp10.txt
[3] => temp15.txt
[1] => temp22.txt
)

သဒ္ဒါ

 natcaseort ( array )
တေးရေး ဖေါ်ပြ
အခင်းအကျင်း လိုအပ်ပါတယ် sorted ခံရဖို့ array ကိုဖေါ်ပြသည်။
သက်ဆိုင်သောဖင်ခှ်ရှင်းများ
  • ပေးထားသောတန်ဖိုးကိုခင်းကျင်းမှုတွင်ရှာဖွေပါ။ အောင်မြင်လျှင်ပထမ ဦး ဆုံးသက်ဆိုင်ရာ key name ကိုပြန်ပို့ပါ array_search

    array_search

    ပေးထားသောတန်ဖိုးကိုခ
  • ခင်းကျင်းအတွက်လက်ရှိဒြပ်စင်ပြန်လာ current

    current

    ခင်းကျင်းအတွက်လက်ရှိ
  • array အတွက်အချို့သို့မဟုတ်အားလုံးသော့ချက်အမည်များကိုပြန်ပို့သည် array_keys

    array_keys

    arrayအတွက်အချို့သို့
  • ကျပန်းတစ် ဦး array ကနေတစ်ခုသို့မဟုတ်တစ်ခုထက်ပိုသောယူနစ်ဆွဲယူ array_rand

    array_rand

    ကျပန်းတစ်ဦးarrayကနေတ
  • Array ရှိယူနစ်များကိုစစ်ထုတ်ရန် CallBack function ကိုသုံးပါ array_filter

    array_filter

    Arrayရှိယူနစ်များကို
  • ပေးထားသောတန်ဖိုးနှင့်အတူခင်းကျင်းဖြည့်ပါ array_fill

    array_fill

    ပေးထားသောတန်ဖိုးနှင့
  • arrays ၏ခြားနားချက်ကိုတွက်ချက်ရန် key name နှိုင်းယှဉ်မှုကိုသုံးပါ array_diff_key

    array_diff_key

    arrays၏ခြားနားချက်ကိ
  • Arrays အတွက်ခလုတ်များနှင့်တန်ဖိုးများကို Swap array_flip

    array_flip

    Arraysအတွက်ခလုတ်များ
လူကြိုက်များသော ဆောင်းပါးများ