大家好,我有以下代码:
$shops = array();
foreach($json as $var)
{
if (in_array($var['shop'], $shops)) {}
else
{
array_push($shops,$var['shop']);
array_push($shops->$var['shop'],array('revenue' => 0, 'numberofbooks' => 0));
}
}
我想要以下内容:
Shops
=> shop1
=> revenue
=> numberofbooks
=>shop2
=> revenue
=> numberofbooks
但是插入第三个数组不起作用,任何人都可以帮助我吗?