搜索php后排序数组值

时间:2013-04-05 01:23:50

标签: php mysql arrays

嗨,由于某些原因我使用表单进行搜索(POST方法)我得到了一个如下所示的数组:

      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 )
           )  

如何在不执行任何其他查询的情况下对此数组进行排序,并使用$ _GET参数或其他参数来获取如下所示的数组:

       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 个答案:

答案 0 :(得分:1)

使用array_reverse()功能。

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