PHP Sort Array based on values in another.....
Posted
by Fearghal
on Stack Overflow
See other posts from Stack Overflow
or by Fearghal
Published on 2010-04-23T11:05:10Z
Indexed on
2010/04/23
11:13 UTC
Read the original article
Hit count: 416
Need some help regarding array sorting....
I have two arrays. The main one (where the key is the user id) :
$user[31] = 'Tom'
$user[43] = 'Jane'
and another array with the order they should be displayed (where key is the order and value is the user id) :
$order[1] = 43
$order[2] = 31
How can I apply the ordering to the main array using the ordering one?
Thanks guys!
© Stack Overflow or respective owner