【发布时间】:2019-04-10 06:43:34
【问题描述】:
我必须按优先级在给定数组下方排序。如果优先级值为 0,则不包括在排序数组中。我尝试了很多方法,但没有得到预期的输出。
Array
(
[recently_viewed] => Array
(
[priority] => 1
[no_of_products] => 1
)
[recently_visited_cat] => Array
(
[priority] => 1
[no_of_products] => 1
)
[last_ordered_items] => Array
(
[priority] => 3
[no_of_products] => 3
)
[searched_based] => Array
(
[priority] => 0
[no_of_products] => 4
)
[cart_based] => Array
(
[priority] => 1
[no_of_products] => 5
)
[wishlist_based] => Array
(
[priority] => 1
[no_of_products] => 6
)
[sku_based] => Array
(
[priority] => 0
[no_of_products] => 7
)
)
请帮帮我。
【问题讨论】:
-
我也试过了,但是不行。所以发布了新问题。
-
那么请分享您的尝试,以便我们提供帮助。
-
我猜你应该在排序前使用
array_filter作为优先级0
标签: php arrays sorting multidimensional-array