For Programmers: Free Programming Magazines  


Home > Archive > PHP Programming > March 2005 > Can anyone help out a PHP newbie?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Can anyone help out a PHP newbie?
joanniejae@lycos.com

2005-03-29, 3:57 am

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:

=B7 The files are numbered sequentially with a filename in the format
#=2Etxt, such as 1.txt, 2.txt, 3.txt, etcetera.

=B7 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:

XYZ Corporation
Aaron Winslow
Contacted
May 12, 2004
Entry Code 2355239

=B7 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
alphabetical order.

=B7 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!

Joannie

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com