How to read the files and directories inside the directory
<p>Can any one please let me know how to read the directory and find what are the files and directories inside that directory.</p>

<p>I've tried with checking the directories by using the <code>is_dir()</code> function as follows</p>

<pre><code>$main = "path to the directory";//Directory which is having some files and one directory
readDir($main);

function readDir($main) {
    $dirHandle = opendir($main);
    while ($file = readdir($dirHandle)) {
        if ($file != "." &amp;&amp; $file != "..") {
            if (is_dir($file)) {
                 //nothing is coming here
            }
        }
    }
}
</code></pre>

<p>But it is not checking the directories.</p>

<p>Thanks</p>
