title: Merge array and regroup data by date
body: <p>I have two multidimensional array and want to group the data by date when it is possible (in php). I tried with merge and merge_recursive but it doesn't work.</p>
  <p>1st Array :</p>
  <pre><code>array(100) {
    [1]=&gt;
    array(1) {
      [&quot;2020-04-18&quot;]=&gt;
      array(1) {
        [&quot;best_price_product&quot;]=&gt;
        float(489.1)
      }
    }
    [2]=&gt;
    array(1) {
      [&quot;2020-04-19&quot;]=&gt;
      array(1) {
        [&quot;best_price_product&quot;]=&gt;
        float(489.1)
      }
    }
    [3]=&gt;
    array(1) {
      [&quot;2020-04-20&quot;]=&gt;
      array(1) {
        [&quot;best_price_product&quot;]=&gt;
        float(489.1)
      }
    }
    [4]=&gt;
    array(1) {
      [&quot;2020-04-21&quot;]=&gt;
      array(1) {
        [&quot;best_price_product&quot;]=&gt;
        float(489.1)
      }
    }
    ….
    }
    
  </code></pre>
  <p>2nd Array :</p>
  <pre><code>  array(88) {
    [1]=&gt;
    array(1) {
      [&quot;2020-04-18&quot;]=&gt;
      array(1) {
        [&quot;best_price_product_mp&quot;]=&gt;
        float(526.3)
      }
    }
    [2]=&gt;
    array(1) {
      [&quot;2020-04-19&quot;]=&gt;
      array(1) {
        [&quot;best_price_product_mp&quot;]=&gt;
        float(526.3)
      }
    }
    [3]=&gt;
    array(1) {
      [&quot;2020-04-20&quot;]=&gt;
      array(1) {
        [&quot;best_price_product_mp&quot;]=&gt;
        float(526.3)
      }
    }
    [4]=&gt;
    array(1) {
      [&quot;2020-05-03&quot;]=&gt;
      array(1) {
        [&quot;best_price_product_mp&quot;]=&gt;
        float(526.3)
      }
    }
  ...
  }
    
    
  </code></pre>
  <p>I would like the result to be like this :</p>
  <pre><code>  array(100) {
    [1]=&gt;
    array(2) {
      [&quot;2020-04-18&quot;]=&gt;
      array(2) {
        [&quot;best_price_product&quot;]=&gt;
        float(489.1)
        [&quot;best_price_product_mp&quot;]=&gt;
        float(526.3)
      }
    }
    [2]=&gt;
    array(1) {
      [&quot;2020-04-19&quot;]=&gt;
      array(2) {
        [&quot;best_price_product&quot;]=&gt;
        float(489.1)
        [&quot;best_price_product_mp&quot;]=&gt;
        float(526.3)
      }
    }
    [3]=&gt;
    array(2) {
      [&quot;2020-04-20&quot;]=&gt;
      array(1) {
        [&quot;best_price_product&quot;]=&gt;
        float(489.1)
        [&quot;best_price_product_mp&quot;]=&gt;
        float(526.3)
      }
    }
    [4]=&gt;
    array(1) {
      [&quot;2020-04-21&quot;]=&gt;
      array(2) {
        [&quot;best_price_product&quot;]=&gt;
        float(489.1)
        [&quot;best_price_product_mp&quot;]=&gt;
        float(526.3)
      }
    }
  [5]=&gt; 
    array(1) {
      [&quot;2020-05-03&quot;]=&gt;
      array(1) {
        [&quot;best_price_product_mp&quot;]=&gt;
        float(526.3)
      }
    }
    ….
    }
  </code></pre>
  <p>In the merge of the two arrays, there are in addition to the merged dates, other dates which are unique in each array.</p>
  <p>Thank you</p>