Sorting a list in PHP

Posted by Andy on Stack Overflow See other posts from Stack Overflow or by Andy
Published on 2010-05-29T21:37:29Z Indexed on 2010/05/29 21:42 UTC
Read the original article Hit count: 300

Filed under:
|

Alright, so I've just (almost) finished my first little php script. Basically all it does is handling forms. It writes whatever the user put in to the fields of the form to a text file, then I include that text file in the index of the little page I have set up.

So, currently it writes to the beginning of the text file (but doesn't overwrite previous data). But, several users wants this list to be alphabetically sorted instead. So what I want to do is make whatever they submit fall into the list in alphabetical order.

The thing here is also that all I use in the text file are divs. The list is basically 'divided' into 3 parts. 'Title', 'Link', and 'Poster'. All I have done is positioned them with css.

So, can I sort this list (the titles, in this case) alphabetically and still have the 'link' and 'poster' information assigned the way they already are, but just with the titles sorted?

It don't use databases at all on my site, so there is no database handling at all used in this script (mainly because I'm not experienced at all in this).

© Stack Overflow or respective owner

Related posts about php

Related posts about html