is_dir() returns FALSE when passed a subfolder
<p>is_dir() according to the php manual returns true if passed a string that refers to a folder.
It's returning false -- despite being passed an array of valid folder names -- this is probably something simple but I'm beating myself up over not finding it.</p>

<p>Here is the code:</p>

<pre><code>define('TEST_SUBFOLDERS_FILES_PATH', 'C:/xampp/htdocs/theProj/mainSubdir/');

$currentFolder = ' ';
$rootOfmainSubdir = TEST_SUBFOLDERS_FILES_PATH';
$theArrayOfDirsAndFilesInmainSubdir;

// fill an array that contains all files and folders under the /mainSubdir folder
// using php's 'scandir()'
if( ($theArrayOfDirsAndFilesInmainSubdir = scandir($rootOfmainSubdir )) != FALSE )
{
  $numArrayEntries = count($theArrayOfDirsAndFilesInmainSubdir);
  echo "&lt;br&gt;&lt;br&gt;The number of folders/files found is:  " . $numArrayEntries;


  // now do the triage on subfolders under /mainSubdir  versus files
  for($i = 0; $i &lt; $numArrayEntries; $i++)
  {
    echo "&lt;br&gt;&lt;br&gt;Current array element is:  " 
            . $theArrayOfDirsAndFilesInmainSubdir[$i]
            . "  and is_dir() on this element returns --&gt; "
            . var_dump( is_dir($theArrayOfDirsAndFilesInmainSubdir[$i]) );  
    // rest of code
</code></pre>

<p>Here is what I see on the output for almost all the folders:</p>

<pre><code>Current array element is: testFolderN and is_dir() on this element returns --&gt;

boolean false
</code></pre>

<p>OR I see:</p>

<pre><code>Current array element is: . and is_dir() on this element returns --&gt;

boolean true
</code></pre>

<p>AND: </p>

<pre><code>Current array element is: .. and is_dir() on this element returns --&gt;

boolean true
</code></pre>

<p>I'm missing something really dumb here but sheesh.  It seems that is_dir() is correctly returning TRUE only for the current folder "." and the parent folder ".."</p>

<p>If there is a nuance I'm missing in the use of is_dir() I'm not seeing it.</p>

<p>Help is appreciated -- all I'm going to do in the code is to make a list of the current subfolders under the TEST_SUBFOLDERS_FILES_PATH if I can get is_dir() to return TRUE not only for "." and ".." but also the other 'testFolderN' subfolders.</p>

<p>By the way -- there is a total of 5 subfolders, and one file in the directory, so the display of the count above is:</p>

<pre><code>The number of folders/files found is: 8
</code></pre>
