title: Sort array of objects
body: <p>I've had trouble with the examples in the PHP manual, so I'd like to ask this here...</p>
  
  <p>I have an array of objects.. Is there a way to sort it based on the contents of the object?</p>
  
  <p>For example, my array is:</p>
  
  <pre><code>Array
  (
      [0] =&gt; stdClass Object
          (
              [id] =&gt; 123
              [alias] =&gt; mike
          )
  
      [1] =&gt; stdClass Object
          (
              [id] =&gt; 456
              [alias] =&gt; alice
          )
  
      [2] =&gt; stdClass Object
          (
              [id] =&gt; 789
              [alias] =&gt; zeke
          )
  
      [3] =&gt; stdClass Object
          (
              [id] =&gt; 987
              [alias] =&gt; dave
          )
  )
  </code></pre>
  
  <p>How do I sort the array by the [alias] of the objects?</p>
  
  <p>In the example, the output should be:</p>
  
  <pre><code>Array
  (
      [0] =&gt; stdClass Object
          (
              [id] =&gt; 456
              [alias] =&gt; alice
          )
  
      [1] =&gt; stdClass Object
          (
              [id] =&gt; 987
              [alias] =&gt; dave
          )
  
      [2] =&gt; stdClass Object
          (
              [id] =&gt; 123
              [alias] =&gt; mike
          )
  
      [3] =&gt; stdClass Object
          (
              [id] =&gt; 789
              [alias] =&gt; zeke
          )
  )
  </code></pre>
  
  <p>Thanks in advance!</p>