0
我希望能找到幫助如何獲得這樣的結構:PHP多維數組結合
[pad] => Array
(
[padi] => Array
(
[Date] => 2016-01-01
[Val] => 1
[Premium] => 100
)
[padi] => Array
(
[Date] => 2016-04-01
[Val] => 1
[Premium] => 200
)
[padi] => Array
(
[Date] => 2016-07-01
[Val] => 1
[Premium] => 300
)
[padi] => Array
(
[Date] => 2016-11-01
[Val] => 1
[Premium] => 400
)
)
我有4個變量:
$p1 = array('padi' =>
array('Date' => $Date_0, 'Val' => $Val, 'padiPremium' => $padiPremium_0));
$p2 = array('padi' =>
array('Date' => $Date_1, 'Val' => $Val, 'padiPremium' => $padiPremium_1));
$p3 = array('padi' =>
array('Date' => $Date_1, 'Val' => $Val, 'padiPremium' => $padiPremium_1));
$p4 = array('padi' =>
array('Date' => $Date_1, 'Val' => $Val, 'padiPremium' => $padiPremium_1));
我已經嘗試與array_push
,array_merge
和array_combine
和這根本不適合我,或者只是我的做法是錯誤的。 我會很樂意提供任何建議!
對於「pad」數組中的所有元素,您不能使用相同的鍵「padi」 –
您所需的結構無效,因爲數組鍵必須是唯一的 –
爲什麼它不能僅僅是'0,1,2, 3'數字鍵?爲什麼** padi **? – Ghost