natcasesort
Array Case-Malensitive အက္ခရာများကို sort လုပ်ရန် "သဘာဝ sorting" 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 ကိုဖေါ်ပြသည်။ |