Sorting multidimensial array by two values containing numbers and letters
<p>I have an array which looks like</p>

<pre><code>[0] =&gt; Array
    (
        [typeName] =&gt; Element
        [quantity] =&gt; 35
        [flag] =&gt; 4
    )
</code></pre>

<p>I already found a way by using <code>usort()</code> to sort an array by its sub elements. Which works great for numeric values.</p>

<pre><code>public static function _sortByAmount($a, $b) {
        return $b['quantity'] - $a['quantity'];
}
</code></pre>

<p>From time to time, it could happen that I have more than one array elements with the same quantity. Those entries should be sorted by the Name too. In the end, the array should look like this.</p>

<pre><code>[0] =&gt; Array
    (
        [typeName] =&gt; Element
        [quantity] =&gt; 567
        [flag] =&gt; 4
    )
[1] =&gt; Array
    (
        [typeName] =&gt; aaa-element
        [quantity] =&gt; 35
        [flag] =&gt; 4
    )
[2] =&gt; Array
    (
        [typeName] =&gt; bbb-element
        [quantity] =&gt; 35
        [flag] =&gt; 4
     )
[3] =&gt; Array
    (
        [typeName] =&gt; Element
        [quantity] =&gt; 10
        [flag] =&gt; 4
    )
</code></pre>

<p>Is it possible to extend my function somehow?</p>
