title: Sort array by two keys
body: <p>I have an array with a couple of names. </p>
  
  <pre><code>$array = Array
  (
  
      [0] =&gt; Array
          (
              [fullname] =&gt; Skyler White
              [fname] =&gt; Skyler
              [lname] =&gt; White
          )
  
      [1] =&gt; Array
          (
              [fullname] =&gt; Walter White
              [fname] =&gt; Walter
              [lname] =&gt; White
          )
  
      [2] =&gt; Array
          (
              [fullname] =&gt; Marie Schrader
              [fname] =&gt; Marie
              [lname] =&gt; Schrader
          )
  
      [3] =&gt; Array
          (
              [fullname] =&gt; Hank Schrader
              [fname] =&gt; Hank
              [lname] =&gt; Schrader
          )
  
      [4] =&gt; Array
          (
              [fullname] =&gt; Jesse Pinkman
              [fname] =&gt; Jesse
              [lname] =&gt; Pinkman
          )
  
  )
  </code></pre>
  
  <p>I’d like the array sorted matching the following criteria:</p>
  
  <p>1) last name <code>lname</code>
  2) first name <code>fname</code></p>
  
  <p>So the ordered array will look like:</p>
  
  <pre><code>$array_ordered = Array
  (
  
      [0] =&gt; Array
          (
              [fullname] =&gt; Jesse Pinkman
              [fname] =&gt; Jesse
              [lname] =&gt; Pinkman
          )
  
      [1] =&gt; Array
          (
              [fullname] =&gt; Hank Schrader
              [fname] =&gt; Hank
              [lname] =&gt; Schrader
          )
  
      [2] =&gt; Array
          (
              [fullname] =&gt; Marie Schrader
              [fname] =&gt; Marie
              [lname] =&gt; Schrader
          )
  
  
      [3] =&gt; Array
          (
              [fullname] =&gt; Skyler White
              [fname] =&gt; Skyler
              [lname] =&gt; White
          )
  
      [4] =&gt; Array
          (
              [fullname] =&gt; Walter White
              [fname] =&gt; Walter
              [lname] =&gt; White
          )
  
  )
  </code></pre>