returning array of folders in directory [closed]

7331

New Member
\[code\] <?php function listFolderFiles($dir,$exclude){ $ffs = scandir($dir); $i=0; echo '<ul class="ulli">'; foreach($ffs as $ff){ if(is_array($exclude) and !in_array($ff,$exclude)){ if($ff != '.' && $ff != '..'){ if(!is_dir($dir.'/'.$ff)){ } else { $a=$ff; $i=1+$i; echo $ff; } if(is_dir($dir.'/'.$ff)) listFolderFiles($dir.'/'.$ff,$exclude); echo '</li>'; } } } echo '</ul>'; return ($a); }\[/code\]\[code\]listFolderFiles\[/code\] function takes directory and return all the folder name in form an array \[code\] $as=listFolderFiles('users',array('index.php','edit_page.php')); ?>\[/code\]
 
Back
Top