Forum Moderators: coopster

Message Too Old, No Replies

convert array(arrays) to array

         

sssweb

5:59 pm on Jul 4, 2010 (gmt 0)

10+ Year Member



What's the easiest way to alphabatize an array of 2-item arrays, using the first of the two items as the sort value? That is, sort:

Array
(
[0] => Array([0] => A, [1] => 1)
[1] => Array([0] => C, [1] => 3)
[2] => Array([0] => B, [1] => 2)
)


to:

Array
(
[0] => Array([0] => A, [1] => 1)
[1] => Array([0] => B, [1] => 2)
[2] => Array([0] => C, [1] => 3)
)

dreamcatcher

9:07 am on Jul 5, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



array_multisort [php.net] should be able to accomplish this.

dc