我有一个名为 job counts 的数组,如下$job =>
Array
(
[0] => Array([count] => 3[yearmonth] => 2019-7)
[1] => Array([count] => 3[yearmonth] => 2019-9)
[2] => Array([count] => 5[yearmonth] => 2019-10))
)
第二个日期数组为$date =>
Array
([0] => Array([yearmonth] => 2019-6)
[1] => Array([yearmonth] => 2019-7)
[2] => Array([yearmonth] => 2019-8)
[3] => Array([yearmonth] => 2019-9)
[4] => Array([yearmonth] => 2019-10)
)
作业数组不是连续数组。所以这里我想要的是,如果一个条目在 $date 中可用但在 $job 中不存在,则创建第三个数组,其中 count = 0 和yearmonth 值。像下面这样的东西
Array
([0] => Array([count] => 0[yearmonth] => 2019-6)
[1] => Array([count] => 3[yearmonth] => 2019-7)
[2] => Array([count] => 0[yearmonth] => 2019-8)
[3] => Array([count] => 3[yearmonth] => 2019-9)
[4] => Array([count] => 5[yearmonth] => 2019-10)
)
杨魅力
LEATH
Qyouu