的基礎上,我有這樣的排序陣列,並安排一定的價值
[Defense] => Array
(
[0] => stdClass Object
(
[id] => 1
[position] => G
[point] => 1.6
)
[1] => stdClass Object
(
[id] => 1
[position] => F
[point] => 2.7
)
[2] => stdClass Object
(
[id] => 1
[position] => C
[point] => 1.4
)
[3] => stdClass Object
(
[id] => 2
[position] => C
[point] => 1.7
)
[4] => stdClass Object
(
[id] => 2
[position] => D
[point] => 1.1
)
[5] => stdClass Object
(
[id] => 1
[position] => F
[point] => 1.7
)
[6] => stdClass Object
(
[id] => 1
[position] => G
[point] => 1.6
)
[7] => stdClass Object
(
[id] => 1
[position] => G
[point] => 1.8
)
[8] => stdClass Object
(
[id] => 2
[position] => D
[point] => 1.5
)
)
我想點descending
在PHP
基礎上排序的數組的數組。此外,所有的位置順序來(全部G
比所有F
等..) 這樣的:
[Defense] => Array
(
[0] => stdClass Object
(
[id] => 1
[position] => G
[point] => 1.8
)
[1] => stdClass Object
(
[id] => 1
[position] => G
[point] => 1.6
)
[2] => stdClass Object
(
[id] => 1
[position] => G
[point] => 1.6
)
[3] => stdClass Object
(
[id] => 1
[position] => F
[point] => 2.7
)
[4] => stdClass Object
(
[id] => 1
[position] => F
[point] => 1.7
)
[5] => stdClass Object
(
[id] => 1
[position] => C
[point] => 1.7
)
[6] => stdClass Object
(
[id] => 2
[position] => C
[point] => 1.4
)
[7] => stdClass Object
(
[id] => 2
[position] => D
[point] => 1.5
)
[8] => stdClass Object
(
[id] => 2
[position] => D
[point] => 1.1
)
)
任何幫助嗎? )`usort(`或`uasort()`:
我說看看PHPS陣列排序功能進行排序。 – arkascha
構建排序算法的邏輯或使用內置數組排序功能。將數組的「點或位置」變量傳遞給排序函數,並對它們進行排序。 –