title: Sort a multidimensional array by two variables
body: <p>I have an array that looks something like below, but it could potentially contain more drafts.</p>
  
  <pre><code>$multi_arr = array(
      'draft1' =&gt; array (
          'alloc_coeff' =&gt; 560,
          'steps_count' =&gt; 2,
          'order_draft' =&gt; array(
              '0' =&gt; array(
                  'whse_id' =&gt; 4,
                  'quantity' =&gt; 0,
                  'percent' =&gt; 0
              ),
              '1' =&gt; array(
                  'whse_id' =&gt; 1,
                  'quantity' =&gt; 10,
                  'percent' =&gt; 66.666666666667
              )           
          )
      ),
      'draft2' =&gt; array (
          'alloc_coeff' =&gt; 1517,
          'steps_count' =&gt; 1,
          'order_draft' =&gt; array(
              '0' =&gt; array(
                  'whse_id' =&gt; 1,
                  'quantity' =&gt; 10,
                  'percent' =&gt; 66.666666666667
              )      
          )
      ),
      'draft3' =&gt; array (
          'alloc_coeff' =&gt; 559,
          'steps_count' =&gt; 2,
          'order_draft' =&gt; array(
              '0' =&gt; array(
                  'whse_id' =&gt; 2,
                  'quantity' =&gt; 0,
                  'percent' =&gt; 0
              ),
              '1' =&gt; array(
                  'whse_id' =&gt; 1,
                  'quantity' =&gt; 10,
                  'percent' =&gt; 66.666666666667
              )           
          )
      )
  );
  </code></pre>
  
  <p>I need to sort the content by using two variables: <code>alloc_coeff</code> and <code>steps_count</code>. </p>
  
  <p>First <code>alloc_coeff</code> needs to be considered from the highest to the lowest value. </p>
  
  <p>And then as a second variable the <code>steps_count</code> from lowest value to highest.</p>
  
  <pre><code>usort($multi_arr, function($a, $b) {
      return $a['alloc_coeff'] &lt;=&gt; $b['alloc_coeff'];
  });
  </code></pre>
  
  <p>I don't need the entire array to be rewritten and stored in a temporary variable, I just need the keys sorted like this (expected outcome) <code>draft2</code>, <code>draft1</code> and lastly <code>draft3</code>.</p>
  
  <p>What's a way to accomplish this?</p>