title: Sort X & Y by size
body: <p>I'm trying to figure out how to sort an array, that has sub arrays which each have an X &amp; Y coordinate. I need to sort the largest size first to the smallest, example:</p>
  
  <pre><code>$sizes = array(
      'a' =&gt; array(
          'x' =&gt; 10,
          'y' =&gt; 140,
      ),
      'b' =&gt; array(
          'x' =&gt; 20,
          'y' =&gt; 24,
      ),
      'c' =&gt; array(
          'x' =&gt; 20,
          'y' =&gt; 40,
      ),
      'd' =&gt; array(
          'x' =&gt; 50,
          'y' =&gt; 50,
      ),
      'e' =&gt; array(
          'x' =&gt; 10,
          'y' =&gt; 9,
      ),
  );
  </code></pre>
  
  <p>Should resort naturally like so:</p>
  
  <pre><code>$sizes = array(
      'e' =&gt; array(
          'x' =&gt; 10,
          'y' =&gt; 9,
      ),
      'b' =&gt; array(
          'x' =&gt; 20,
          'y' =&gt; 24,
      ),
      'c' =&gt; array(
          'x' =&gt; 20,
          'y' =&gt; 40,
      ),
      'd' =&gt; array(
          'x' =&gt; 50,
          'y' =&gt; 50,
      ),
      'a' =&gt; array(
          'x' =&gt; 10,
          'y' =&gt; 140,
      ),
  );
  </code></pre>
  
  <p>I've sorted by value before using asort, however I'm not sure how to sort and maintain index association on a multidimensional array like this. Any help would be great!</p>