0

Hi for some reasons When I did a search with a form(POST Method) I got an array which look like this below:

      Array(
            [0] =>Array ( [0] => 2008 [1] => Name1 [2] => Surname1 )
            [1] =>Array ( [0] => 2009 [1] => Name2 [2] => Surname2 ) 
            [2] =>Array ( [0] => 2010 [1] => Name3 [2] => Surname3 )
           )  

How can I sort this array without executing any other query and using $_GET parameter or another for getting an array which look like this:

       Array(
            [0] =>Array ( [0] => 2010 [1] => Name3 [2] => Surname3 )
            [1] =>Array ( [0] => 2009 [1] => Name2 [2] => Surname2 ) 
            [2] =>Array ( [0] => 2008 [1] => Name1 [2] => Surname1 )
           ) 

1 Answer 1

1

With array_reverse() function.

Manual: http://php.net/manual/en/function.array-reverse.php

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.