Didn’t You Know About PHP’s trim Function?
- 0
- Add a Comment
So I am sitting here, coding away working on an auto-updater for WicketPixie (the next release should be out soon btw) and I just can’t understand the problem I’m having. I am retrieving a file’s contents and comparing it to a variable, but for some reason it’s coming back as false when I compare it. I scratched my noggin over this for a day or so, then just dropped everything because I had to go to school (*sigh*). I don’t know what happened, but my brain was refreshed and it came to me: Files contain line terminator characters and whatnot.
So, then I just run the trim() function on the string containing the file’s contents and what do you know, it all works.
I’ve gone ahead and linked to the trim function in the PHP manual, so you can check out the examples there. Let this be a lesson to you, don’t forget about those ninja characters in files.


