-1
我有兩個數組,像這樣:重複PHP數組的鑰匙
[day0_units] => 0
[day1_units] => 12
[day1_start] => 08:00:00
[day1_end] => 11:00:00
[day2_units] => 12
[day2_start] => 07:00:00
[day2_end] => 11:00:00
[day3_units] => 0
[day4_units] => 12
[day4_start] => 10:00:00
[day4_end] => 12:00:00
[day5_units] => 12
[day5_start] => 08:00:00
[day5_end] => 03:00:00
[day6_units] => 0
[day0_units] => 0
[day0_start] => 10:00:00
[day0_end] => 01:00:00
[day1_units] => 12
[day1_start] => 08:00:00
[day1_end] => 11:00:00
[day2_units] => 12
[day2_start] => 07:00:00
[day2_end] => 11:00:00
[day3_units] => 0
[day3_start] =>
[day3_end] =>
[day4_units] => 12
[day4_start] => 10:00:00
[day4_end] => 12:00:00
[day5_units] => 12
[day5_start] => 08:00:00
[day5_end] => 03:00:00
[day6_units] => 0
所有我想要做的就是複製數組鍵,兩個數組應該有相同的位置相同的密鑰和保留,如果任何一個值。有什麼建議麼?
不能確定這是否是你想要的方向,但你看着['array_merge'(HTTP:/ /php.net/manual/en/function.array-merge.php)有什麼機會? –
@Mari M:我不認爲這會工作,因爲數組的某些值需要保留。一個關鍵將會丟失,我想添加它。 –