title: PHP (folder) File Listing in Alphabetical Order?
body: <p>I'm not sure how simple this would be, but I'm using a script which displays the files from a specific folder, however I'd like them to be displayed in alphabetical order, would it be hard to do this? Here's the code I'm using:</p>
  
  <pre><code>if ($handle = opendir($mainframe-&gt;getCfg( 'absolute_path' ) ."/images/store/")) {
          while (false !== ($file = readdir($handle))) {
              if ($file != "." &amp;&amp; $file != "..")  {
                  if (($file != "index.html")&amp;&amp;($file != "index.php")&amp;&amp;($file != "Thumbs.db")) {
                  $strExt = end(explode(".", $file));
                      if ($strExt == 'jpg') {
                          $Link = 'index.php?option=com_shop&amp;amp;task=deleteFile&amp;amp;file[]='.$file;
                          $thelist .= '&lt;tr class="row0"&gt;&lt;td nowrap="nowrap"&gt;&lt;a href="'.$Link.'"&gt;'.$file.'&lt;/a&gt;&lt;/td&gt;'."\n";
                          $thelist .= '&lt;td align="center" class="order"&gt;&lt;a href="'.$Link.'" title="delete"&gt;&lt;img src="/administrator/images/publish_x.png" width="16" height="16" alt="delete"&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;'."\n";
                      }
  
                  }
              }
          }
          closedir($handle); 
      }   
      echo $thelist;
  </code></pre>
  
  <p>:)</p>