လက်ရှိတည်နေရာ: ပင်မစာမျက်နှာ> ဖန်ရှင်အမျိုးအစားများ> 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 ကိုဖေါ်ပြသည်။
သက်ဆိုင်သောဖင်ခှ်ရှင်းများ
  • ခင်းကျင်းမှု၏အစိတ်အပိုင်းတစ်ခုဖယ်ရှားခြင်းနှင့်အခြားတန်ဖိုးများနှင့်အစားထိုးလိုက်ပါ array_splice

    array_splice

    ခင်းကျင်းမှု၏အစိတ်အပ
  • အသုံးပြုသူသတ်မှတ်ထားသောနှိုင်းယှဉ်မှု function များကို အသုံးပြု. တန်ဖိုးများကို array တစ်ခုတွင်စီရန်နှင့်အညွှန်းကိန်းကိုဆက်ထားပါ uasort

    uasort

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

    array_filter

    Arrayရှိယူနစ်များကို
  • index စစ်ဆေးမှုနှင့်အတူ Array ၏လမ်းဆုံ compute array_intersect_assoc

    array_intersect_assoc

    indexစစ်ဆေးမှုနှင့်အ
  • Arrays ၏ပြောင်းပြန် sorting rsort

    rsort

    Arrays၏ပြောင်းပြန်so
  • Array ၏အစတွင်ယူနစ်တစ်ခုသို့မဟုတ်တစ်ခုထက် ပို. ထည့်ပါ array_unshift

    array_unshift

    Array၏အစတွင်ယူနစ်တစ်
  • interatively callback function ကိုနှင့်အတူတစ်ခုတည်းတန်ဖိုးကိုရန် array ကိုရိုးရှင်းအောင်ရှင်းပါ array_reduce

    array_reduce

    interativelycallback
  • index check နှင့်အတူ Array ၏လမ်းဆုံလမ်းခွကိုတွက်ချက်ပါ, array_intersect_uassoc

    array_intersect_uassoc

    indexcheckနှင့်အတူAr
လူကြိုက်များသော ဆောင်းပါးများ