Do you have a question? Post it now! No Registration Necessary. Now with pictures!
March 29, 2005, 4:21 am
rate this thread
Just now learning my way around PHP, and I'm having trouble with
something that I'm sure is a breeze for more experienced PHP coders.
Hoping someone can help.
I have a Web directory filled with text files that I need sorted
alphabetically. The details are:
· The files are numbered sequentially with a filename in the format
#.txt, such as 1.txt, 2.txt, 3.txt, etcetera.
· I need to sort them by a client name that appears in the first line
of each file. The files look like something like this:
May 12, 2004
Entry Code 2355239
· It's crucial that the sorted files be renumbered sequentially, as a
report routine that pulls reports from the files freaks out if it finds
a missing number. They numerical order would have to match the
· All the files exist in a single Web directory with no other files,
so paths are not a consideration. And since there is nothing in the
directory but the files to be sorted, operations on the entire
directory are possible.
Can anyone suggest anything appropriate to accomplish this, even
something quick and dirty? I've been doing bubble sorts for years in
other languages, but I'm not up to speed on PHP enough yet to get it
working. I could probably be tacky and resort to doing it in
QuickBASIC, but who on earth wants to do THAT? ;-)
Thanks for any help you can provide!