title: php Sort multidimensional array but start index at 1
body: <p>I have a multidimensional array and I want to sort based off the 'rating'... but I also want the index to start at 1 which is what I used when manually creating these.  When I use usort it rearranges the array but now they start at index 0 so I can't do a loop from 1 - 6 because 6 is undefined after sort.  </p>
  
  <p>It was cleaner to start my $array at 1 so $player[$i] represented that actual player number.  Here's what my array looks like before sort</p>
  
  <pre><code>$player[1]['rating'] = 8
  $player[2]['rating'] = 5
  $player[3]['rating'] = 10
  </code></pre>
  
  <p>Here's my sort function:</p>
  
  <pre><code>function sortByrating($a, $b) {
      if ($a['rating'] == $b['rating']) {
          return 0;
      }
      return ($a['rating'] &lt; $b['rating']) ? -1 : 1;
  }
  </code></pre>
  
  <p>And I call it by</p>
  
  <pre><code>usort($player, 'sortByRating');
  </code></pre>