title: Echo all the folder names in a folder
body: <p>I want to print all the folder names inside a parent folder. The current issue I am facing is, though I have 400+ folders in a folder only 257 are getting printed. Again, this is not at all issue related with permissions.</p>
  
  <p>Please find my code below:  </p>
  
  <pre><code>    $newdir = "content/";
       $dircnt = 0;
  // Open a known directory, and proceed to read its contents
  if (is_dir($newdir)) {
      if ($dh = opendir($newdir)) {
         while (($file = readdir($dh)) !== false) {
             $dircnt++;
             if(filetype($newdir. $file) == 'dir') {
              echo "filename: $file : filetype: " . filetype($newdir. $file) . "dircnt:"        .$dircnt. "&lt;br&gt;";
            }
         }
         closedir($dh);
        }
     }
  }
  </code></pre>