Jump to content

[SOLVED] Quick Array Sorting Question


Flames

Recommended Posts

I need to be able to quickly sort an array (key and value kept corresponding), but instead of using letters i want to use numbers, i looked over all the sort functions and krsort seems the most like what i need, a reverse sort of the keys maintaining the value it has but with numbers, so 999 => value1, 1000 => value2, 998 => value3 would become 1000 => value2, 999 => value1, 998 => value3, and if krsort is the right one if i was to use a foreach loop, would the foreach to the array in the sorted order so 1000 first, or would it do it in an normal numeric/alphabetic order 1,2,3,4,5 (a,b,c,d,e) etc

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.