按desc和b asc - array排序(key => array(a,b)

时间:2017-02-24 08:06:50

标签: php arrays sorting multidimensional-array

我有一个这样的数组:

$array = array($team => array('points' => x, 'runs' => y))

我汇总积分并与同一团队一起运行,结果是这样的:

[team1] => Array
    (
        [points] => 12
        [runs] => 1
    )

[team2] => Array
    (
        [points] => 11
        [runs] => 3
    )

[team3] => Array
    (
        [points] => 11
        [runs] => 2
    )

[team4] => Array
    (
        [points] => 8
        [runs] => 3
    )

我想通过运行DESC和点ASC对它进行排序。 就像:

[team4] => Array
    (
        [points] => 8
        [runs] => 3
    )
[team2] => Array
    (
        [points] => 11
        [runs] => 3
    )
[team3] => Array
    (
        [points] => 11
        [runs] => 2
    )
[team1] => Array
    (
        [points] => 12
        [runs] => 1
    )

0 个答案:

没有答案