我在 api 响应中得到了关联数组结构,如下所示
{
"error": false,
"msg": "Success",
"result_user_wish_list": {
"my_whishlist": [
{
"id": 6,
"product_name": "abc",
"price": 300,
"user_id": 6,
"shop_name": 12,
"is_buy": 0,
"purchase_by": null,
"created_at": "2020-07-01T21:34:43.000000Z",
"updated_at": "2020-07-01T21:34:43.000000Z",
"shop_name": "Relience",
"shop_zipcode": "390016",
"user_name": "ABC"
},
{
"id": 2,
"product_name": "Rice",
"price": 1200,
"user_id": 1,
"shop_id": 10,
"is_buy": 0,
"purchase_by": null,
"created_at": "2020-06-16T12:02:04.000000Z",
"updated_at": "2020-07-03T16:06:42.000000Z",
"shop_name": "Dmart",
"shop_zipcode": "390017",
"user_name": "XYZ"
}
],
"my_friends_list": [
[
{
"id": 2,
"product_name": "Rice",
"price": 1200,
"user_id": 1,
"shop_id": 12,
"is_buy": 0,
"purchase_by": null,
"created_at": "2020-06-16T12:02:04.000000Z",
"updated_at": "2020-07-03T16:06:42.000000Z",
"shop_name": "Relience",
"shop_zipcode": "390016",
"user_name": "MNJ"
}
]
]
}
}
我想从这个数组中创建另一个数组,就像我们有相同的数组一样,shop_name然后shop_zipcode从这个数组中创建另一个数组,就像
但这样我只能按shop_name对数组进行排序,并且我希望我可以按shop_name和shop_zipcode对数组进行排序
胡子哥哥