Jump to content

[SOLVED] php array sort


desithugg

Recommended Posts

Umm I want to sort an array twice.

First alphabetically

than numerically.

I tried

sort($arry);

But that just sorts it numerically.

given me the output

HM02,HM03,HM04,HM05,TM01,TM02,TM04,TM05,TM07,TM11,TM12,TM13,TM14,TM15,TM16,TM17,TM18,TM19,TM23,TM24,TM25,TM26,TM27,TM28,TM29,TM30,TM35,TM36,TM37,TM38,TM39,TM40,TM41,TM42,TM43,TM45,TM46,TM47,TM48,TM49,HM01,TM03,TM06,TM08,TM09,TM10,TM20,TM21,TM22,TM31,TM32,TM33,TM34,TM44,TM50

So as you can see there's mixing between HM and TM I want them both seperate.

Any body know how i can do that?

Link to comment
https://forums.phpfreaks.com/topic/51510-solved-php-array-sort/
Share on other sites

Can you show some more of the code (e.g. creating the array, sorting and printing). What you are showing doesn't make sense. You should not be getting the results you state. I took the values you have above, mixed them up, applied sort to the array, and I am getting expected results.

Link to comment
https://forums.phpfreaks.com/topic/51510-solved-php-array-sort/#findComment-253681
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.