I'm working with an associative array with key value which the keys are Persian strings and the problem is when i use ksort to sort the array. the problem is sorting process has no effect on four specific character and put them in the end of sorted array. here is those 4 characters:
گ چ پ ژ
I think this happened because 4 chars are not exists in Arabic letters. here is an example
$main_array = array("محمد"=>55,"علی"=>67,"رضا"=>90,"گلاب"=>34) after ksort it must show this as result: رضا,علی,گلاب,محمد but the ksort result this: رضا,علی,محمد,گلاب
Array
(
[فولاد امیر کبیر] => ۶۵۵
[شرکت فولاد کیان ابهر] => ۶۶۵
[فولاد آریا ذوب] => ۶۵۶
[گروه صنعتی فولاد یزد] => ۶۵۱
[فولاد قائم رازی] => ۶۶۴
[فولاد سیادن ابهر] => ۶۶۳
[مجتمع فولاد البرز غرب] => ۶۴۹
[شرکت فولاد سپهر ایرانیان] => ۶۶۱
[فولاد کیان کاشان] => ۶۵۷
[فولاد شاهرود] => ۶۵۴
[فولاد آناهیتا گیلان] => ۶۵۹
[نورد آریان فولاد] => ۶۴۸
[فولاد میانه] => ۶۵۸
[فولاد بافق یزد] => ۶۶۲
[فولاد قزوین] => ۶۶۰
[پرشین فولاد آریا] => ۶۵۲
[فولاد نیشابور] => ۶۵۳
[فولاد کویر کاشان] => ۶۵۰
[ذوب آهن اصفهان] => ۶۴۷
)
//here is the example which ksort working properly by english chars
$myarray = array(
"reza"=>35,
"mohamad"=>56,
"nima"=>45,
"ali"=>76,
);
ksort($myarray);
print_r($myarray);
//here is the example which ksort not working properly by persian chars
$mypersianarray = array(
"علی"=>35,
"گلاب"=>56,
"رضا"=>45,
"محمد"=>76,
);
ksort($myarray);
print_r($mypersianarray);
//output
Array ( [علی] => 35 [گلاب] => 56 [رضا] => 45 [محمد] => 76 )
//which is wrong and گلاب goes at end