How to downsize an array by removing duplicates and assign new string value based on key value difference?
<p>There is this array where it presents a list of restaurants for a searched food name it needs to be downsized to unique results.
This array as you can see can contain duplicate restaurant names the key factor is the preparation time the array needs to assign a string with a value of "multi-options" if the restaurant names match but the preparation time is different. </p>

<p><strong>The array:</strong></p>

<pre><code>$restaurants = array (
  1 =&gt; 
  array (
    'restaurant' =&gt; 'Chefoncall',
    'slug' =&gt; 'chefoncall1',
    'lat' =&gt; 45.495869200000001,
    'long' =&gt; -73.57524699999999,
    'distance' =&gt; '0.07',
    'preparation' =&gt; 0,
  ),
  2 =&gt; 
  array (
    'restaurant' =&gt; 'Chefoncall',
    'slug' =&gt; 'chefoncall1',
    'lat' =&gt; 45.495869200000001,
    'long' =&gt; -73.57524699999999,
    'distance' =&gt; '0.07',
    'preparation' =&gt; 0,
  ),
  3 =&gt; 
  array (
    'restaurant' =&gt; 'Chefoncall',
    'slug' =&gt; 'chefoncall1',
    'lat' =&gt; 45.495869200000001,
    'long' =&gt; -73.57524699999999,
    'distance' =&gt; '0.07',
    'preparation' =&gt; 0,
  ),
  4 =&gt; 
  array (
    'restaurant' =&gt; 'Chefoncall',
    'slug' =&gt; 'chefoncall1',
    'lat' =&gt; 45.495869200000001,
    'long' =&gt; -73.57524699999999,
    'distance' =&gt; '0.07',
    'preparation' =&gt; 0,
  ),
  5 =&gt; 
  array (
    'restaurant' =&gt; 'Chefoncall',
    'slug' =&gt; 'chefoncall1',
    'lat' =&gt; 45.495869200000001,
    'long' =&gt; -73.57524699999999,
    'distance' =&gt; '0.07',
    'preparation' =&gt; 15,
  ),
  6 =&gt; 
  array (
    'restaurant' =&gt; 'Chefoncall',
    'slug' =&gt; 'chefoncall1',
    'lat' =&gt; 45.495869200000001,
    'long' =&gt; -73.57524699999999,
    'distance' =&gt; '0.07',
    'preparation' =&gt; 10,
  ),
  7 =&gt; 
  array (
    'restaurant' =&gt; 'Chefoncall',
    'slug' =&gt; 'chefoncall1',
    'lat' =&gt; 45.495869200000001,
    'long' =&gt; -73.57524699999999,
    'distance' =&gt; '0.07',
    'preparation' =&gt; 20,
  ),
  8 =&gt; 
  array (
    'restaurant' =&gt; 'Chefoncall',
    'slug' =&gt; 'chefoncall1',
    'lat' =&gt; 45.495869200000001,
    'long' =&gt; -73.57524699999999,
    'distance' =&gt; '0.07',
    'preparation' =&gt; 0,
  ),
  9 =&gt; 
  array (
    'restaurant' =&gt; 'Chefoncall',
    'slug' =&gt; 'chefoncall1',
    'lat' =&gt; 45.495869200000001,
    'long' =&gt; -73.57524699999999,
    'distance' =&gt; '0.07',
    'preparation' =&gt; 0,
  ),
  10 =&gt; 
  array (
    'restaurant' =&gt; 'Chefoncall',
    'slug' =&gt; 'chefoncall1',
    'lat' =&gt; 45.495869200000001,
    'long' =&gt; -73.57524699999999,
    'distance' =&gt; '0.07',
    'preparation' =&gt; 5,
  ),
  11 =&gt; 
  array (
    'restaurant' =&gt; 'Chefoncall',
    'slug' =&gt; 'chefoncall1',
    'lat' =&gt; 45.495869200000001,
    'long' =&gt; -73.57524699999999,
    'distance' =&gt; '0.07',
    'preparation' =&gt; 0,
  ),
  12 =&gt; 
  array (
    'restaurant' =&gt; 'Chefoncall',
    'slug' =&gt; 'chefoncall1',
    'lat' =&gt; 45.495869200000001,
    'long' =&gt; -73.57524699999999,
    'distance' =&gt; '0.07',
    'preparation' =&gt; 0,
  ),
  13 =&gt; 
  array (
    'restaurant' =&gt; 'Alto Burger',
    'slug' =&gt; 'alto-burger',
    'lat' =&gt; 45.487302399999997,
    'long' =&gt; -73.637301199999996,
    'distance' =&gt; '3.04',
    'preparation' =&gt; 10,
  ),
  14 =&gt; 
  array (
    'restaurant' =&gt; 'Alto Burger',
    'slug' =&gt; 'alto-burger',
    'lat' =&gt; 45.487302399999997,
    'long' =&gt; -73.637301199999996,
    'distance' =&gt; '3.04',
    'preparation' =&gt; 10,
  ),
  15 =&gt; 
  array (
    'restaurant' =&gt; 'Subway',
    'slug' =&gt; 'subway1',
    'lat' =&gt; 45.268204699999998,
    'long' =&gt; -72.143240399999996,
    'distance' =&gt; '71.29',
    'preparation' =&gt; 3,
  ),
)
</code></pre>

<p>This array presents :</p>

<ol>
<li><strong>Chefoncall</strong> (that has different preparation time values) and needs to present one array with preparation value of "multi-option".</li>
<li><strong>Alto Burger</strong> (that has 2 arrays but same preparation time of 10) and needs to present one array with the preparation time of 10.</li>
<li><strong>Subway</strong> (this has one array and a preparation time of 3) and it needs to present as it is no need to alter this.</li>
</ol>

<p><strong>The required output</strong></p>

<pre><code>  $restaurantsdownsized = array (
  1 =&gt; 
  array (
    'restaurant' =&gt; 'Chefoncall',
    'slug' =&gt; 'chefoncall1',
    'lat' =&gt; 45.495869200000001,
    'long' =&gt; -73.57524699999999,
    'distance' =&gt; '0.07',
    'preparation' =&gt; 'multi-option',
  ),
  14 =&gt; 
  array (
    'restaurant' =&gt; 'Alto Burger',
    'slug' =&gt; 'alto-burger',
    'lat' =&gt; 45.487302399999997,
    'long' =&gt; -73.637301199999996,
    'distance' =&gt; '3.04',
    'preparation' =&gt; 10,
  ),
  15 =&gt; 
  array (
    'restaurant' =&gt; 'Subway',
    'slug' =&gt; 'subway1',
    'lat' =&gt; 45.268204699999998,
    'long' =&gt; -72.143240399999996,
    'distance' =&gt; '71.29',
    'preparation' =&gt; 3,
  ),
)
</code></pre>

<p>Then it needs to generate the following div elements so it can be added as a marker to a google map.</p>

<pre><code>    foreach($restaurantsdownsized as $mp){  
        echo '&lt;div class="radarmarkers" 
                data-lat="'.$mp['lat'].'" 
                data-long="'.$mp['long'].'" 
                data-title="'.$mp['restaurant'].'"
                data-preparation= "'.$mp['preparation'].' '.t('Minutes').'"
                data-map-icon= "icon_'.$mp['preparation'].'"
                &gt;&lt;/div&gt;';
    }
</code></pre>