Re: Reading File Name
| From: | Jason Wong | Date: | Fri, 14 Feb 2003 04:44:25 +0000 |
| Subject: | Re: Reading File Name | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-135546@lists.php.net to get a copy of this message | ||
On Friday 14 February 2003 08:40, PR wrote:
> Hello all,
>
> I am fairly new to PHP and I am trying to read files in
> the directory (gif files)and based on the names of
> the files create links on the page. The words within the file will be
> separated with underscores(02_13_2002_This_file_name.gif but I do not
> have to use underscores if it is going to make things easier).
> I am also trying to sort the names as they are represented as
> names/dates combination..
You'll find that using ISO format for date -- YYYYMMDD (with
underscores/hyphens/whatever between each element if you wish) -- will enable
easy sorting by date.
> Could anyone help me to jump start this especially with splitting the
> name and sorting? Should I read the file names into an array and sort it?
> (read first 10 characters [date] split it - put into an array; then
> read the rest parse it and place into an array?)
Use explode(). And yes, use arrays.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
You can no more win a war than you can win an earthquake.
-- Jeannette Rankin
*/