title: php read directory sorting
body: <p>i have a little php script that reads a directory and then echos all the files (jpg's in this case) into a jquery image slider. it works perfectly, but i dont know how to sort the images by name desending. at the moment the images are random. </p>
  
  <pre><code>&lt;?php
  $dir = 'images/demo/';
  if ($handle = opendir($dir)) {
  
  while (false !== ($file = readdir($handle))) {
      echo '&lt;img src="'.$dir.$file.'"/&gt;';
  }
  
  closedir($handle);
  }
  ?&gt;
  </code></pre>
  
  <p>any help on this would be great.</p>
  
  <p>one more thing i dont understand. the script pics up 2 nameless non jpg files in that folder that does not exist???   but i havnt realy checked into that yet</p>