我有这个数组:
array (
0 =>
array (
'banner' => 'banner1',
'dayofweek' => '1',
'count' => '3',
),
1 =>
array (
'banner' => 'banner1',
'dayofweek' => '2',
'count' => '1',
),
2 =>
array (
'banner' => 'banner2',
'dayofweek' => '2',
'count' => '3',
)
)
我需要在 highcharts 中使用它来获得两个不同的向量,其中 dayofweek 为 day,count 为 value。这应该是 highcharts 数组:
series:[
{
name:'banner1',
data:[3,1,0,0,0,0,0,]
},
{
name:'banner2',
data:[0,3,0,0,0,0,0,]
}
]
我猜我需要以这种方式拥有数组:
array (
0 =>
array (
'banner' => 'banner1',
'counts' => '3,1,0,0,0,0,0'
),
1 =>
array (
'banner' => 'banner2',
'counts' => '0,3,0,0,0,0,0'
)
)
如何解析数组以获得我需要的格式?