Forum Moderators: coopster

Message Too Old, No Replies

Sort multi-dimensional array on 2nd dim.

         

Glitzer

11:13 pm on Dec 24, 2017 (gmt 0)

10+ Year Member



Hi,
I have a multidimensional array like this and would like it sorted on array[]['title].
The array[]['id'] and array[]['title'] stay grouped but the array[] is reorganized.
Does anyone have a way to easily do this with php?
Thanks in advance.


Array (
[0] => Array
(
[id] => 3704
[title] => Zebras
)

[1] => Array
(
[id] => 3705
[title] => Ants
)

[2] => Array
(
[id] => 3706
[title] => Bees
)

And would like it to be

Array (
[0] => Array
(
[id] => 3705
[title] => Ants
)

[1] => Array
(
[id] => 3706
[title] => Bees
)

[2] => Array
(
[id] => 3704
[title] => Zebras
)

Peter_S

11:20 am on Feb 16, 2018 (gmt 0)

5+ Year Member Top Contributors Of The Month



Hi,

I think you want the "Example #3" on this page : [php.net...]

Glitzer

6:05 pm on Feb 16, 2018 (gmt 0)

10+ Year Member



Thank you. I'll give that a try.
Make it a nice day! You deserve it.