Jump to content

Sorting Array


squiblo

Recommended Posts

I have an array that looks like this...

 

Array ( 
    [0] => Array ( [0] => 2 [1] => Dylan Cross )
    [1] => Array ( [0] => 5 [1] => Bob Smith )
    [2] => Array ( [0] => 1 [1] => Sarah Park )
    [3] => Array ( [0] => 7 [1] => Jane Knowles ) 
    [4] => Array ( [0] => 6 [1] => Harry Hill )
    [5] => Array ( [0] => 3 [1] => Jack Rock )
)

 

How do I sort this array so it is ordered alphabetically by the names so the result will be...

 

Array (
    [0] => Array ( [0] => 5 [1] => Bob Smith )
    [1] => Array ( [0] => 2 [1] => Dylan Cross )
    [2] => Array ( [0] => 6 [1] => Harry Hill )
    [3] => Array ( [0] => 3 [1] => Jack Rock )
    [4] => Array ( [0] => 7 [1] => Jane Knowles ) 
    [5] => Array ( [0] => 1 [1] => Sarah Park )
)

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/256426-sorting-array/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.