title: How do I sort a multidimensional array by one of the fields of the inner array in PHP?
body: <p>Suppose I have an array that mimics a database table. Each array element represents a row, and within each row is another array that contains the field names and values. </p>
  
  <pre><code>Array
  (
      [0] =&gt; Array
          (
              [name] =&gt; 'Sony TV'
              [price] =&gt; 600.00
          )
  
      [1] =&gt; Array
          (
              [name] =&gt; 'LG TV'
              [price] =&gt; 350.00
          )
  
      [2] =&gt; Array
          (
              [name] =&gt; 'Samsung TV'
              [price] =&gt; 425.00
          )  
  }
  </code></pre>
  
  <p>What I want to do is sort the rows (outer array elements) by price. Below is an example of what I want to achieve:</p>
  
  <pre><code>Array
  (
      [0] =&gt; Array
          (
              [name] =&gt; 'LG TV'
              [price] =&gt; 350.00
          )
  
      [1] =&gt; Array
          (
              [name] =&gt; 'Samsung TV'
              [price] =&gt; 425.00
          )
  
      [2] =&gt; Array
          (
              [name] =&gt; 'Sony TV'
              [price] =&gt; 600.00
          )        
  }
  </code></pre>
  
  <p>As you can see, I don't need to preserve the keys of the outer array.</p>