Re: sorting files by date
| From: | David T-G | Date: | Wed, 12 Nov 2003 01:52:43 +0000 |
| Subject: | Re: sorting files by date | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-169222@lists.php.net to get a copy of this message | ||
Justin --
..and then Justin French said...
%
% Hi,
Hi!
%
% I have a dir of files saved in the following format: YYYY-MM-DD.mp4. I
OK. So what are you filming? :-)
% know how to get the file names into an array, but I don't know how to
% sort the array so that the files appear in date order. My guess was to
If the filename has anything to do with the date, then just sort it. MM
is numeric and not alphabetic, right?
% use strtotime() to get the date into a timestamp, then sort on the
% timestamp, but there MUST be an easier way :)
Um, yeah :-)
If the filenames are *not* related to the actual dates, then just stat()
each file and sort based on those results.
%
% I've read through most of the array part of the manual, but can't see
% what I need.
I bet it's sort() :-)
%
%
% Justin
HTH & HAND
:-D
--
David T-G * There is too much animal courage in
(play) davidtg@justpickone.org * society and not sufficient moral courage.
(work) davidtgwork@justpickone.org -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur
Pbzzhavpngvbaf Qrprapl Npg!