I have two different arrays 

```
$dates =  [
  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",
  7 => "2019-01-10"
]

```

and below is dynamic which can different but let see an example 

```
$Fresh_Record =  [
    "date" => array:2 [
        0 => "2019-01-10"
        1 => "2019-01-14"
    ]
    "counter" => array:2 [
        0 => 1000.0
        1 => 500.0
    ]
]

```

As you can see above array which has date and `counter`. As you know the counter `1000.0` is for `2019-01-10` and `500` for `2019-01-14` . 

These are only records which are available but I need last 7 days records. So I want to add `0` if no record available for any date. 

I am trying and tried a lot to achieve but still failed to achieve it. 

**First Attempt**

```
$ARR_1 = array();

        foreach($result as $AA){
            $data['counter'][] = 0;
        }

        $MERGE = array_merge($data['counter'],$yAxis_ARR);

        $MAIN = [
            'date' => $d,
            'counter' => $MERGE 
        ];

```

**Other attempts** 

```
$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++;
}

```

**Help**

I really need guidance to resolve it. Kindly guide me please. Thank you so much.

I want to make is like below

```
$map_array =  [
        "date" => [
          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""
        ]
        "counter" => [
            0 => 1000.0,
            1 => 500.0,
            2 => 0,
            3 => 0,
            4 => 0,
            5 => 0,
            6 => 0
        ]
    ]

```