我有一个数组:
$test = Array
(
["foo"] => Array
(
["totalsales"] => 80
["totalamount"] => 4
)
(
我想添加具有值的新索引:
$test["foo"][$date] = 20; // $date = 2013-06-30
$test["foo"][$date] = 40; // $date = 2013-06-25
输出如下所示:
$test = Array
(
["foo"] => Array
(
["totalsales"] => 80
["totalamount"] => 4
["2013-06-25"] => 40
)
(
我希望数组看起来像这样:
$test = Array
(
["foo"] => Array
(
["totalsales"] => 80
["totalamount"] => 4
["2013-06-30"] => 20
["2013-06-25"] => 40
)
(
如何才能做到这一点?感谢并为我糟糕的英语感到抱歉。