title: Sorting .gz files in a directory
body: <p>I have following files in my directory - <code>case-1.gz , case-2.gz, ........ , case-12.gz, index.xml</code> . Below is my code to sort the files in alphabetical order - </p>
  
  <pre><code>$dir = '/var/www/html/es/a';
  $files = array_diff(scandir($dir,1), array('..', '.', 'index.xml'));
  print_r($files);
  </code></pre>
  
  <p>which outputs as follows - </p>
  
  <pre><code>    Array
  (
      [1] =&gt; case-9.gz
      [2] =&gt; case-8.gz
      [3] =&gt; case-7.gz
      [4] =&gt; case-6.gz
      [5] =&gt; case-4.gz
      [6] =&gt; case-3.gz
      [7] =&gt; case-2.gz
      [8] =&gt; case-12.gz
      [9] =&gt; case-11.gz
      [10] =&gt; case-10.gz
      [11] =&gt; case-1.gz
  )
  </code></pre>
  
  <p>I need to have an array with the pattern <code>case-12.gz, case-11.gz, case-10.gz, case-8.gz, ........ , case-1.gz</code></p>
  
  <p>Also in my above output offset 0 of array is missing as I need to access the top most sorted files in an array.</p>