 <p>Try this:</p> <pre><code>$total = array(); foreach ($data as $key =&gt; $row) { $total[$key] = $row['total']; } // this sorts your $data array by `total` in descending order // so the max for `total` is the first element array_multisort($total, SORT_DESC, $data); </code></pre> <p>And now, use <code>$data[0]</code>;</p>