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
https://forums.phpfreaks.com/topic/220467-puzzled-by-array_multisort/
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.