faqts : Computers : Programming : Languages : PHP : Common Problems

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

6 of 12 people (50%) answered Yes
Recently 4 of 10 people (40%) answered Yes

Entry

please help me with a script- sort files in a directory by date
how do you sort files from a directory in an array by date?
how do i sort a listing of files from a directory in an array by date?

Jul 19th, 2004 23:28
Alder Rus, Diana Bergen, http://www.directoryonclick.com , http://www.singapore-yellow-pages.com


$dir = opendir(".");
        while($f = readdir($dir))
        {
                if(eregi(".html$", $f)){
                        $file = join("", file($f));
                        echo "$file";
                        #eregi("<title>(.*)</title>", $file, 
$title_array);
                        #print "<li><a href='$f'>$title_array[1]
</a></li>";
                }
        }
 iwant to add sorting by date to the array- this is my week two with 
php and everything is completely confusing.
Thank you for your help
In the end this script is supposed to give a listing of html files in 
a directory sorted by lastmodified.