whitespace at end of fgets output

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
BeauMN
Forum Newbie
Posts: 6
Joined: Fri Nov 24, 2006 5:20 pm

whitespace at end of fgets output

Post by BeauMN »

I'm using fgets to read lines from a text file I made. I used pico to make the text file, with one word per line (I just hit enter to go to the next line)

I want to compare the words to some variable strings I have, but I find that the strings returned from fgets all have a white space at the end of them.

I tried using the chop() function on them, but this doesn't remove the spaces. Any suggestions?

Thanks
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

BeauMN
Forum Newbie
Posts: 6
Joined: Fri Nov 24, 2006 5:20 pm

Post by BeauMN »

Thanks!!
Post Reply