我有以下数组:
Array
(
[0] => Array
(
[note] => test
[year] => 2011
[type] => football
)
[1] => Array
(
[note] => test1
[year] => 2010
[type] => basket
)
[2] => Array
(
[note] => test2
[year] => 2012
[type] => football
)
[3] => Array
(
[note] => test3
[year] => 2009
[type] => basket
)
[4] => Array
(
[note] => test4
[year] => 2010
[type] => football
)
)
我想首先按类型根据另一个数组对其进行排序:
例如:$sort = array('football','basket');
然后按年。
我怎样才能做到这一点?
谢谢。
期望的输出应该是:
Array
(
[2] => Array
(
[note] => test2
[year] => 2012
[type] => football
)
[0] => Array
(
[note] => test
[year] => 2011
[type] => football
)
[4] => Array
(
[note] => test4
[year] => 2010
[type] => football
)
[1] => Array
(
[note] => test1
[year] => 2010
[type] => basket
)
[3] => Array
(
[note] => test3
[year] => 2009
[type] => basket
)
)
我不介意我们是否重置索引值。
谢谢。