I am trying to push an item of array to another array.
$index = 0;
        foreach($d as $single){
            if(!in_array($single,$Fresh_Record['date'])){
                if(count($Fresh_Record['date']) >= $index){
                    $map_array['date'] = $Fresh_Record['date'][$index];
                    $map_array['counter'] = 0;
                }
            }
            $index++;
        }
where
$d =  [
  0 => "2019-01-17"
  1 => "2019-01-16"
  2 => "2019-01-15"
  3 => "2019-01-14"
  4 => "2019-01-13"
  5 => "2019-01-12"
  6 => "2019-01-11"
]
And
$Fresh_Record =  [
    "date" => array:2 [
        0 => "2019-01-10"
        1 => "2019-01-14"
    ]
    "counter" => array:2 [
        0 => 1000.0
        1 => 500.0
    ]
]
But it's return error Undefined offset: 2.
Actaully I am trying to store dates into $map_array['date'] from $d which are not it $Fresh_Record['date'].
Also same thing with the counter, as you can see in the array. So date not available in $Fresh_Record['date'] then I want to add the date from $d to 
$map_array['date'] and also counter 0.
After @SPlatten Comment
$index = 0;
        foreach($d as $single){
            if(!in_array($single,$Fresh_Record['date'])){
                if(isset($Fresh_Record['date'][$index]))
                    $map_array['date'] = $Fresh_Record['date'][$index];
                } 
            }
            $index++;
        }
 
    