title: php directory listing files in numerical order
body: <p>How would I change this function so that it listed the files in order as currently they are sorted randomly. I have already changed it so it excludes the Index.php file. Any help would be much appreciated.</p>
  
  <pre><code>function DirDisply() {
  $TrackDir=opendir(".");
  
  while ($file = readdir($TrackDir)) {
  $info = pathinfo($file);
  $file_name =  basename($file,'.'.$info['extension']);
  if ($file == "." || $file == ".." || $file == "index.php"){ }
  else {
  print "&lt;p&gt;&lt;a class=btn href=$file target=content&gt;Item Number $file_name&lt;/a&gt;&lt;/p&gt;";
  
  }
  }
  closedir($TrackDir);
  return;
  }
  </code></pre>