Cleaning PHP code is Fun
Really. I'm serious. At least in this case, it was fun, because I know now that it's done, my life will be a lot easier.
My work site is powered by PHP. The off-the-shelf script I used to power the home manager is called Free Realty. I'm using an older version of it where the code isn't as clean (and even the new version isn't as clean as it probably could be, but it's fairly plug and play). But the version I have used a TON of echo statements to create its various pages. Now, echo statements are fine if you're processing variables inside those echoes, but there were just large echo statements full of HTML, and it was just annoying to look at, especially so since HomeSite doesn't color code the HTML inside PHP tags -- meaning it's really hard to read. So today I got rid of a bunch of echo tags, did a lot more in-line PHP if/else stuff, replaced the longer echo blocks with short-tag versions of echo in-line with the HTML, reduced the amount of overall if/else statements and the code is a lot cleaner and easier on the eyes. It will make a future project I'm working on a hell of a lot easier, too (as I plan on reusing a lot of this same code).
I'm starting to pretend pretty well that I know what I'm doing with this stuff ;-) Prior to this job, I didn't know a damn thing about PHP, other than knowing a coworker or two were studs at it. But working here was the first real shot I've had at it, and it's a blast. Beats working on the piece of crap ASP server I have upstairs any day of the week.