title: Count how many files in directory PHP
body: <p>I'm working on a slightly new project. I wanted to know how many files are in a certain directory.</p>
  
  <pre><code>&lt;div id="header"&gt;
  &lt;?php 
      $dir = opendir('uploads/'); # This is the directory it will count from
      $i = 0; # Integer starts at 0 before counting
  
      # While false is not equal to the filedirectory
      while (false !== ($file = readdir($dir))) { 
          if (!in_array($file, array('.', '..') and !is_dir($file)) $i++;
      }
  
      echo "There were $i files"; # Prints out how many were in the directory
  ?&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>This is what I have so far (from searching). However, it is not appearing properly? I have added a few notes so feel free to remove them, they are just so I can understand it as best as I can.</p>
  
  <p>If you require some more information or feel as if I haven't described this enough please feel free to state so.</p>