Directoryies and Arrays

From: Date: Thu, 07 Dec 2000 15:47:13 +0000
Subject: Directoryies and Arrays
Groups: php.general 
Request: Send a blank email to php-general+get-29144@lists.php.net to get a copy of this message
Hello, I am trying to read the contents of a directory into 2 arrays. 1 array being a directorys array and the other a Files array. Currently i have: <? if (!isset($dir)){ $dir=getcwd(); }; echo $dir; ?> <TABLE CELLPADDING="2" CELLSPACING="2"> <? $handle=opendir($dir); while ($file = readdir($handle)) { if (is_dir($file){ ?> <TR> <TD ALIGN="left" COLSPAN=2><B><?echo $file?></B><?echo $dir_array[0]?></TD> </TR> <? } }; $handle=opendir($dir); while ($file = readdir($handle)) {
    if (is_file($file)){
?> <TR> <TD>&nbsp;</TD> <TD ALIGN="left" WIDTH="100"><?echo $file?></TD> </TR> <? } } closedir($handle); ?> </TABLE> The table list the directories first then the files... That is cool just that the directorys and files. I would like to get them into an order so I thought hey use and array!!! I just can not figure how to write the array in the while loop. Thanks for your help!!!

« previous php.general (#29144) next »