我需要按 [price] 的值对数组(较低)进行排序,但如果 [stock] = 0 的值,我也需要对它们进行排序,但它们的位置应低于 [stock] > 0 的值。函数有对于任意数量的子数组,数组 lower 只是示例。
我有数组
Array
(
[0] => Array
(
[cardname] => Tundra Wolves
[edition] => Legends
[stock] => 0
[price] => 5
[shop] => cernyrytir.cz
)
[1] => Array
(
[cardname] => Tundra Wolves
[edition] => Legends
[stock] => 20
[price] => 9
[shop] => mysticshop.cz
)
[2] => Array
(
[cardname] => Tundra Wolves
[edition] => Legends
[stock] => 5
[price] => 5
[shop] => najada.cz
)
[3] => Array
(
[cardname] => Tundra Wolves
[edition] => Legends
[stock] => 0
[price] => 3
[shop] => rishada.cz
)
)
我需要数组:
Array
(
[2] => Array
(
[cardname] => Tundra Wolves
[edition] => Legends
[stock] => 5
[price] => 5
[shop] => najada.cz
)
[1] => Array
(
[cardname] => Tundra Wolves
[edition] => Legends
[stock] => 20
[price] => 9
[shop] => mysticshop.cz
)
[3] => Array
(
[cardname] => Tundra Wolves
[edition] => Legends
[stock] => 0
[price] => 3
[shop] => rishada.cz
)
[0] => Array
(
[cardname] => Tundra Wolves
[edition] => Legends
[stock] => 0
[price] => 5
[shop] => cernyrytir.cz
)
)
提前感谢您的帮助。