title: Convert multidimensional array in custom form
body: <p>I have array</p>
  
  <pre><code>     $arr = array (
    0 =&gt; 
    array (
      'id' =&gt; '340',
      'days' =&gt; '1',
      'start_date' =&gt; '2018-10-12 00:00:00',
      'end_date' =&gt; '2018-10-13 00:00:00',
    ),
    1 =&gt; 
    array (
      'id' =&gt; '346',
      'days' =&gt; '2',
      'start_date' =&gt; '2018-10-12 00:00:00',
      'end_date' =&gt; '2018-10-14 00:00:00',
    ),
    2 =&gt; 
    array (
      'id' =&gt; '339',
      'days' =&gt; '3',
      'start_date' =&gt; '2018-10-12 00:00:00',
      'end_date' =&gt; '2018-10-15 00:00:00',
    ),
    3 =&gt; 
    array (
      'id' =&gt; '302',
      'days' =&gt; '4',
      'start_date' =&gt; '2018-10-12 00:00:00',
      'end_date' =&gt; '2018-10-16 00:00:00',
    ),
    4 =&gt; 
    array (
      'id' =&gt; '308',
      'days' =&gt; '5',
      'start_date' =&gt; '2018-10-12 00:00:00',
      'end_date' =&gt; '2018-10-17 00:00:00',
    ),
    5 =&gt; 
    array (
      'id' =&gt; '354',
      'days' =&gt; '1',
      'start_date' =&gt; '2018-10-13 00:00:00',
      'end_date' =&gt; '2018-10-14 00:00:00',
    ),
    6 =&gt; 
    array (
      'id' =&gt; '369',
      'days' =&gt; '1',
      'start_date' =&gt; '2018-10-14 00:00:00',
      'end_date' =&gt; '2018-10-15 00:00:00',
    )
  );
  </code></pre>
  
  <p><strong>Output:</strong> </p>
  
  <pre><code>$arr = array (
  
        0 =&gt; 
        array (
          'id' =&gt; '308',
          'days' =&gt; '5',
          'start_date' =&gt; '2018-10-12 00:00:00',
          'end_date' =&gt; '2018-10-17 00:00:00',
        ),
        1 =&gt; 
        array (
          'id' =&gt; '354',
          'days' =&gt; '1',
          'start_date' =&gt; '2018-10-13 00:00:00',
          'end_date' =&gt; '2018-10-14 00:00:00',
        ),
        2 =&gt; 
        array (
          'id' =&gt; '369',
          'days' =&gt; '1',
          'start_date' =&gt; '2018-10-14 00:00:00',
          'end_date' =&gt; '2018-10-15 00:00:00',
        )
      );
  </code></pre>
  
  <p>Condition :</p>
  
  <p>I want remove duplicate 'start_date' i.e. start_date = 2018-10-12 with lowest number of 'days' and only preserve the date which consists of higher number of days. I have tried using mysql query but I have not got desired output also I have tried array_unique() with numeric format parameter but I have not got any success yet. Help is appreciated. Thanks In advance.</p>