多維數組我有這樣的多維數組,稱爲$rent
:排序在PHP
Array
(
[product2] => Array
(
[dates] => Array
(
[2013-07-25] => 2
[2013-07-23] => 1
[2013-07-21] => 3
)
)
[product3] => Array
(
[dates] => Array
(
[2013-07-24] => 5
[2013-07-22] => 4
[2013-07-20] => 3
)
)
[product1] => Array
(
[dates] => Array
(
[2013-07-29] => 1
[2013-07-28] => 2
[2013-07-27] => 2
)
)
)
我想做一個雙排序:
- 首先,上升了ProductX
- 然後,對於每個產品,按升序日期
因此,生成的數組將會b e:
Array
(
[product1] => Array
(
[dates] => Array
(
[2013-07-27] => 2
[2013-07-28] => 2
[2013-07-29] => 1
)
)
[product2] => Array
(
[dates] => Array
(
[2013-07-21] => 3
[2013-07-23] => 1
[2013-07-25] => 2
)
)
[product3] => Array
(
[dates] => Array
(
[2013-07-20] => 3
[2013-07-22] => 4
[2013-07-24] => 5
)
)
)
我該如何達到這個目標?提前
我試圖在array_multisort($租金),什麼都沒有發生 – Ivan