How to get all files from folders and subfolders with full path using scandir
<p>I am looking for a solution how to get all files from folders and subfolders with full path using scandir?</p>

<p>I wrote this so far:</p>

<pre><code>function listFolderFiles($dir){
    $ffs = scandir($dir);
    $i = 0;
    $list = array();
    foreach ( $ffs as $ff ){
        if ( $ff != '.' &amp;&amp; $ff != '..' ){
            if ( strlen($ff)&gt;=5 ) {
                if ( substr($ff, -4) == '.php' ) {
                    $list[] = $ff;
                    echo dirname($ff) . $ff . "&lt;br/&gt;";
                }    
            }       
            if( is_dir($dir.'/'.$ff) ) 
                    listFolderFiles($dir.'/'.$ff);
        }
    }
    return $list;
}

$files = array();
$files = listFolderFiles(dirname(__FILE__));
</code></pre>

<p>but that does not load files with full path. it only shows filenames. and I filtered files that ends with .php</p>

<p>Thanks a lot for help!!</p>
