Welcome to WebmasterWorld Guest from 54.163.42.154

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Sort multi-dimensional array on 2nd dim.

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

New User

10+ Year Member

joined:Feb 27, 2006
posts: 33
votes: 0


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
)
11:20 am on Feb 16, 2018 (gmt 0)

Full Member

Top Contributors Of The Month

joined:Apr 20, 2017
posts:334
votes: 73


Hi,

I think you want the "Example #3" on this page : [php.net...]
6:05 pm on Feb 16, 2018 (gmt 0)

New User

10+ Year Member

joined:Feb 27, 2006
posts: 33
votes: 0


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