PDA

View Full Version : Parsing a text file...


Smirks
09-26-2002, 01:25 AM
Hi,

I'm trying to code something in PHP that will parse a simple text file.

The file contains two lines, looking something like this.

Heading: "A quote of some sort"
List: list of words

What I want to do is leave the "Heading" line untouched. I want to count the words in the List line, and be able to omit certain words from appearing in the list.

:edit:
Also, I want to put comma's in between the words on the 2nd line.

Please note, that the file does actually look like what I wrote above, Heading and List titles too.
:/edit:

How can I do this? I'm quite a novice at PHP, so any help is appreciated!

Thanks,
C

FlyingDutchman
09-26-2002, 04:38 AM
where do you keep the list of words? in a file (each on a new line?)? in a (mysql) database? or in the actual php file itself?

Smirks
09-26-2002, 12:27 PM
Originally posted by FlyingDutchman
where do you keep the list of words? in a file (each on a new line?)? in a (mysql) database? or in the actual php file itself?
The text file contains just what I wrote before. Where the words come from is irrelevant. They're just there. All the PHP code has to do is parse those words, count them and put comma's in between them and be able to omit certian words that may appear.