Another mark against PHP
So last night I decided to change the post dates on this page so that they’re no longer h2 headings (it’s not the date that’s important for a post, it’s the title). Now, I haven’t been so good about making all my edits in one place. Sometimes I edit the files locally, then FTP them over, and sometimes I edit them directly on my host. If I then want to edit something locally again, I download it from the host with FTP. Not a problem. But my computer is running Windows, and the hosting provider is running Unix. So of course the newline characters are different. So now my index.php has a bunch of big spaces all over the place. Naturally, I’m annoyed by this, so I delete all those extra lines.
Now comes the problem. I FTP the modified file back onto the hosting provider, then reload the page.
Parse error on line 1
What? Well, I’m not a PHP coder, so I figure maybe it didn’t like the way I was using quotes in a method call I changed. So I change it back. Same error. So now I change everything back to how it was before. Same error! What the heck is going wrong?
The original index.php that came with WordPress still worked fine, just not my own version. I tried copying from the original to my version in my Java IDE. Still no luck. Finally, I get the bright idea to look at the two versions in Notepad, which kindly shows boxes instead of newlines. I cut and paste the top few lines now using Notepad, and try again.
It works!
Why in the world should the newline character affect the parsing?