我需要在多維數組上運行一個foreach腳本。在多維數組上運行一個php foreach循環
原來的JSON的格式如下:
{
"_links":{
},
"chatter_count":15,
"chatters":{
"moderators":[
"moderator1",
"moderator2",
"moderator3"
],
"staff":[
"staff1",
"staff2",
"staff3"
],
"admins":[
"admin1",
"admin2",
"admin3"
],
"global_mods":[
"global_mod1",
"global_mod2",
"global_mod3"
],
"viewers":[
"viewer1",
"viewer2",
"viewer3"
]
}
}
有運行json_decode
得到一個PHP數據結構,我現在失去了對如何經營foreach循環輸出是這樣的:
chatter_count: 15
moderators:
moderator1
moderator2
moderator3
staff:
staff1
staff2
staff3
admins:
admin1
admin2
admin3
global_mods:
global_mod1
global_mod2
global_mod3
viewers:
viewer1
viewer2
viewer3
你到目前爲止嘗試過什麼? –