Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3985348
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:52:47+00:00 2026-05-20T05:52:47+00:00

Thought I will point out first that I have looked around on Stackoverflow and

  • 0

Thought I will point out first that I have looked around on Stackoverflow and the internet already and although they are plenty of examples none of them are explained into such a way for me to understand how to convert the code to work with my array structure.

I believe I need to use one of the functions uksort or uasort but unsure on this as well.

My array looks like the following.

Array
(
    [0] => Array
        (
            [Result] => Array
                (
                    [id] => 260
                    [event_id] => 72
                    [year] => 2010
                    [york_score] => 27
                    [york_points] => 0.0
                    [lancs_score] => 51
                    [lancs_points] => 4.0
                    [winner] => L
                    [confirmed] => Y
                    [updated] => 2010-05-01 16:10:03
                )

            [Event] => Array
                (
                    [id] => 72
                    [sport_id] => 25
                    [event_title] => 1st Team
                    [Sport] => Array
                        (
                            [id] => 25
                            [sport_title] => Netball
                        )

                )

        )

And where its [0] means it continues on.

I need to sort all of the arrays [0,1,2,3,…] by the sport_title key found in [Event][Sport]

Does anyone know how to create a sorting function to do this?

Some explanation of how the function is working would also be helpful if I later need to adapter/alter the code to work else where on my site.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T05:52:48+00:00Added an answer on May 20, 2026 at 5:52 am

    Where $array is the name of the array which holds the array you posted in your question.

    function sort_multi($item_1, $item_2)
    {
       // strcmp looks at two strings and, based off the characters' and their order,
       // determines which one is numerically greater. When this function returns a
       // negative, for example, it means the first item it's comparing is less that the
       // second item (ef and eg, for example). The usort function then rearranges
       // the array based off these comparisons.
       return strcmp($item_1['Event']['Sport']['sport_title'], $item_2['Event']['Sport']['sport_title']);
    }
    
    usort($array, 'sort_multi');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I do have somewhat of a feeling that people will try to beat me
I thought I heard that py2exe was able to do this, but I never
I thought that there was some way in .net 3.0 to give an array
I thought I'd offer this softball to whomever would like to hit it out
I have encountered a strange Invalid Packet Lenght (that is how the error is
Let's say I have an (x,y) that is always the same for the start
I have found this example on StackOverflow: var people = new List<Person> { new
I know that many people, at a first glance of the question, may immediately
I have been have issues trying to retrieve the values from a treeMap that
My company has a product that will I feel can benefit from a web

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.