0
請注意一個基本問題。有人可以幫助我獲得所有三個maincategory字符串(事情做,交通和生活)。我只發現如何讓他們個人獲取多維數組中所有具有相同索引的數組元素
$categories[0]->maincategory;
但我怎麼能得到他們所有三個?非常感謝!
Array
(
[0] => stdClass Object
(
[id] => 2
[maincategory] => Things to Do
[category] => Activities and Attractions
)
[1] => stdClass Object
(
[id] => 6
[maincategory] => Transportation
[category] => Airport Transfers
)
[2] => stdClass Object
(
[id] => 11
[maincategory] => Living
[category] => Broadband Internet
)
)
那麼我們應該得到你的初始數據結構?和期望的結果? –