The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
How can I sort a multidimensional array using php?
I have always done all my sorting of data within the sql query, however for once, i need to do it in php and since ive never done this in php, i'm a bit stumped, hoping someione can assist...
My array looks like this: PHP Code:
ORDER BY sc_ispd DESC, dateline DESC, groupid DESC I'm pretty sure i need to use array_multisort() to do this, but having some difficulty with it. Is it even possible to do what i am trying to do here? |
#2
|
|||
|
|||
PHP Code:
|
#3
|
||||
|
||||
Thanks - that worked for sorting on one criteria, however since i need to sort on multiple criteria, I had to dig around a bit but finally found a function on php.net with works for me and i'll post it here for others:
PHP Code:
$array = sc_sortarray($array, "sc_ispaid", DESC, "dateline", DESC, "groupid", DESC); |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|