這是以下數組我正在...!我怎麼能把它分類。多維數組按價格排序升序和降序
Array
(
[0] => Array
(
[0] => Array
(
[price] => 29.99
[params] =>
[text] => demotext
)
[1] => Array
(
[price] => 22.40
[params] =>
[text] => demotext
)
[2] => Array
(
[price] => 12.95
[params] =>
[text] => demotext
)
[3] => Array
(
[price] => 9.60
[params] =>
[text] => demotext
)
)
[1] => Array
(
[0] => Array
(
[price] => 8.16
[params] =>
[text] => demotext
)
[1] => Array
(
[price] => 7.66
[params] =>
[text] => demotext
)
[2] => Array
(
[price] => 7.19
[params] =>
[text] => demotext
)
[3] => Array
(
[price] => 7.14
[params] =>
[text] => demotext
)
)
正如你可以在索引看到2陣列未排序怎麼一回事,因爲5.10應該在索引[1]和4.79對指數[2]
[2] => Array
(
[0] => Array
(
[price] => 5.99
[params] =>
[text] => demotext
)
[1] => Array
(
[price] => 4.79
[params] =>
[text] => demotext
)
[2] => Array
(
[price] => 5.10
[params] =>
[text] => demotext
)
[3] => Array
(
[price] => 4.20
[params] =>
[text] => demotext
)
)
[3] => Array
(
[0] => Array
(
[price] => 4.08
[params] =>
[text] => demotext
)
[1] => Array
(
[price] => 4.00
[params] =>
[text] => demotext
)
[2] => Array
(
[price] => 3.20
[params] =>
[text] => demotext
)
[3] => Array
(
[price] => 3.19
[params] =>
[text] => demotext
)
)
[4] => Array
(
[0] => Array
(
[price] => 2.86
[params] =>
[text] => demotext
)
[1] => Array
(
[price] => 3.58
[params] =>
[text] => demotext
)
[2] => Array
(
[price] => 2.82
[params] =>
[text] => demotext
)
[3] => Array
(
[price] => 2.90
[params] =>
[text] => demotext
)
)
)
你到目前爲止嘗試過什麼? –
可能的重複在這裏:http://stackoverflow.com/questions/2699086/sort-multi-dimensional-array-by-value – Atiris
你期望的結果是什麼? –