Php, DirectoryIterator
<p>I am trying to understand part of the output I get from this code:</p>

<pre><code>&lt;?php
class DirectoryReader extends DirectoryIterator
    {

        function __construct($path)
        {

            parent::__construct($path);
        }


        function current()
        {
            return parent::getFileName();
        }

        function valid()
        {
            if(parent::valid())
            {
                if (!parent::isDir())
                {
                    parent::next();
                    return $this-&gt;valid();
                }
            return TRUE;
            }
            return FALSE;
        }

    } 

    try
    {

        $it = new DirectoryReader('C:\wamp\www');

        while($it-&gt;valid())
        {

            echo $it-&gt;current().'&lt;br /&gt;';

            $it-&gt;next();
        }
    }
    catch(Exception $e)
    {
        echo 'No files Found!&lt;br /&gt;';
    }
?&gt;
</code></pre>

<p>At the code you can see that I pass this path to the constructor: <code>C:\wamp\www</code>,</p>

<p>What I don't understand: before I can see all the folders the first line is <code>.</code>, the second is <code>..</code>, and then I can see the folder names for example:</p>

<pre><code>.
..
someFolder
someOtherFolder
</code></pre>

<p>I know that <code>.</code> present the current folder and <code>..</code> is getting back at the folders hierarchy, but I can't understand why does it print the <code>.</code> then <code>..</code> and then the folders?
I really want to understand the action of this iterator, if can some one please help me understand I will be very thankful.</p>
