title: getting the highest value from an associative array in and if equal, get the highest with the lowest other value
body: <p>Let me try and explain this as easy as possible. I have an array which contains the shipping fees of several products.</p>
  
  <p>I have the value of</p>
  
  <p>Item ID
  Local Shipping
  International Shipping
  Additional Local Shipping
  Additional International Shipping</p>
  
  <p>To make it easier, I just need to know how to calculate the part of the local shipping. I can afterwards apply the same formula to the international shipping part.</p>
  
  <p>The array may contain 1 or 5 or 100 products, each with their own different (or same) amounts, like this:</p>
  
  <pre><code>Array ( 
  
      [0] =&gt; Array ( 
          [item_id] =&gt; 788 
          [local_shipping] =&gt; 13.00 
          [intl_shipping] =&gt; 45.00 
          [addl_local_shipping] =&gt; 10.00 
          [addl_intl_shipping] =&gt; 20.00 
      )
      [1] =&gt; Array ( 
          [item_id] =&gt; 234 
          [local_shipping] =&gt; 23.00 
          [intl_shipping] =&gt; 5.00 
          [addl_local_shipping] =&gt; 1.00 
          [addl_intl_shipping] =&gt; 2.00 
      )
      [2] =&gt; Array ( 
          [item_id] =&gt; 543 
          [local_shipping] =&gt; 23.00 
          [intl_shipping] =&gt; 6.00 
          [addl_local_shipping] =&gt; 0.50 
          [addl_intl_shipping] =&gt; 5.00 
      )
  
  ) 
  </code></pre>
  
  <p>So, what I'm trying to get is the array that contains the HIGHEST local_shipping value, which in that case would be both [1] and [2] with "23.00".</p>
  
  <p>If there's only one unique highest value, I need it to return the "local_shipping" and the "addl_local_shipping" like</p>
  
  <pre><code>Local Shipping is 23.00 and additional local shipping is 1.00
  </code></pre>
  
  <p>Now, if there's 2 arrays with common highest values, I need it to return the one with the LOWEST "addl_local_shipping" value, which in that case is [2] like:</p>
  
  <pre><code>Local Shipping is 23.00 and additional local shipping is 0.50
  </code></pre>
  
  <p>Does that make sense?</p>
  
  <p>I was able to get the highest "local_shipping" value out of the array with this:</p>
  
  <pre><code>$max = 0;
  foreach( $my_array as $k =&gt; $v )
  {
  $max = max( array( $max, $v['local_shipping'] ) );
  }
  echo "Local Shipping is " . $max;
  </code></pre>
  
  <p>But I have no idea how to figure out how to print the related "addl_local_shipping" string AND sort out the problem if there are multiple ones with an equal high value.</p>