title: Displaying images from folder in php
body: <p>Hello I have this code to show image from folder in php :</p>
  
  <pre><code>$handle = opendir(dirname(realpath(__FILE__)).'/galerija/accomodation/');
  while($file = readdir($handle)) {
      if($file !== '.' &amp;&amp; $file !== '..') {
          echo '&lt;img src="galerija/accomodation/'.$file.'" rel="colorbox" /&gt;';
      }
  }
  </code></pre>
  
  <p>and it's working everthing is fine but how can I set to show folder sorter by name or something, because I really need to sort that images and this script show's only random images.Thank you.</p>