1
$array1=Array("2016-11-02","2016-11-03","2016-11-04","2016-11-05","2016-11-06","2016-11-07","2016-11-08");
$array2 = Array([0] => Array("count" => 2 ,"created_at"=> 2016-11-04));
//期望的結果將環路一個陣列,並創建由新的數組組合兩個陣列
$array3 = Array(
[0] => Array("count" => 0 ,"created_at" => 2016-11-02),
[1] => Array("count" =>0 "created_at" => 2016-11-03),
[2] => Array("count" => 2 ,"created_at" => 2016-11-04),
[3] => Array("count" => 0 ,"created_at" => 2016-11-05),
[4] => Array("count" =>0 ,"created_at" => 2016-11-06),
[5] => Array("count" => 0 ,"created_at" => 2016-11-07),
[6] => Array("count" => 0 ,"created_at" => 2016-11-08)
);
嘗試[array_merge()](HTTP: //www.w3schools.com/php/func_array_merge.asp) –
如果將一個指令分隔符(;)放入數組中,您將會在php中出錯。 –
也將逗號分隔數組中的每個項目。如果你不用逗號,你也會得到一個錯誤。 –