Jump to content

Puzzled by array_multisort


pault

Recommended Posts

I am using a multiple array with the layout:

userarray['score'][00]

userarray['id][00]

userarray['name'][00]

etc

where the first column contains properties and the second column is the number for each user (shown as 00). After putting the data into the array, I want to sort the array by the score with the highest at the top. I have used the code:

array_multisort($userarray['score'], SORT_NUMERIC, SORT_DESC);

but it seems to sort the 'score' column while leaving the other columns in the original order. Obviously I want all the rows to remain related to each other.

 

Can anyone help?

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.