我在這陣混亂的點點..如何創建逗號從嵌套數組分隔列表中的PHP
其實我有這樣的
Array
(
[0] => stdClass Object
(
[restaurant_id] => 1
[food_item] => Chicken Spicy Pizza
)
[1] => stdClass Object
(
[restaurant_id] => 1
[food_item] => Pepper Chicken Sandwich
)
[2] => stdClass Object
(
[restaurant_id] => 6
[food_item] => Chicken Tikka Roll
)
[3] => stdClass Object
(
[restaurant_id] => 6
[food_item] => Grilled Chicken
)
)
在這裏,我需要一個數組創建的food_item
逗號分隔值,並且還必須有一個條件具有相同restaurant_id
也合併數組..
即; ..
我的鰭人陣應該是這樣..
Array
(
[0] => stdClass Object
(
[restaurant_id] => 1
[food_item] => Chicken Spicy Pizza,Pepper Chicken Sandwich
)
[1] => stdClass Object
(
[restaurant_id] => 6
[food_item] => Chicken Tikka Roll,Grilled Chicken
)
)
什麼建議?!! ...
謝謝!
什麼你試過嗎?建議根據您的嘗試。 –