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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.