PHP Sort Array By SubArray Value
Posted
by Sjwdavies
on Stack Overflow
See other posts from Stack Overflow
or by Sjwdavies
Published on 2010-03-19T13:09:56Z
Indexed on
2010/03/19
13:21 UTC
Read the original article
Hit count: 192
I've got the following structue of array:
Array
(
[0] => Array
(
[configuration_id] => 10
[id] => 1
[optionNumber] => 3
[optionActive] => 1
[lastUpdated] => 2010-03-17 15:44:12
)
[1] => Array
(
[configuration_id] => 9
[id] => 1
[optionNumber] => 2
[optionActive] => 1
[lastUpdated] => 2010-03-17 15:44:12
)
[2] => Array
(
[configuration_id] => 8
[id] => 1
[optionNumber] => 1
[optionActive] => 1
[lastUpdated] => 2010-03-17 15:44:12
)
)
What's the best way for order the array, in an incremental way based on the optionNumber?
So the results look like:
Array
(
[0] => Array
(
[configuration_id] => 8
[id] => 1
[optionNumber] => 1
[optionActive] => 1
[lastUpdated] => 2010-03-17 15:44:12
)
[1] => Array
(
[configuration_id] => 9
[id] => 1
[optionNumber] => 2
[optionActive] => 1
[lastUpdated] => 2010-03-17 15:44:12
)
[2] => Array
(
[configuration_id] => 10
[id] => 1
[optionNumber] => 3
[optionActive] => 1
[lastUpdated] => 2010-03-17 15:44:12
)
)
© Stack Overflow or respective owner