[thelist] PHP directory sort by date
Aleem Bawany
aleem.bawany at utoronto.ca
Wed Jan 22 21:32:00 CST 2003
> have you thought of shelling out to the OS and running ls
> -t (or dir /o:d for Win32) and then parsing the output?
Along similar lines, PHP allows you to execute shell commands:
$grab = shell_exec("dir/od/b");
that'll grab the dir ordered by date, in bare format and
output it. dir/? for more options.
Why don't you just use the "filectime" and "filemtime"
functions to get the timestamps for the file and sort
those? You would have to come up with a sorting algorithm
or use a binsort or something:
google.com/search?q=php+binary+sort
or maybe store them in an array and use an array sorting
function:
google.com/search?q=php+manual+array+functions
aleem
[ http://members.evolt.org/aleem/ ]
More information about the thelist
mailing list