Well, after abandoning my post for updating this for a while, I figure I might want to try Steve Yegge’s suggestion of being more opinionated in my blog. If nothing more, it might generate a bit of hate mail.

I’m going to be honest. I enjoy writing web apps. I really enjoy the back end code and the product at the end. I have done pretty much everything of significance in PHP also. This shouldn’t offend anyone yet, but some people might see PHP and think less of me. And the real question becomes why?

Now I’ve asked a lot of my friends this question. The general answer usually comes down to PHP yielding bad code or being unmaintainable. Um… I don’t think that’s PHP’s fault that the last person who worked on this project kinda hacked it together into somewhat working but terrible shape. Most if not all programming languages allow you to write bad or unmaintainable code (purely functional languages might be the exception, but my experience with them is far too limited to be able to comment). To be quite honest, I don’t have a problem maintaining my php code. Larger projects always have a framework (one I made usually) to power them and small scripts can easily be navigated by using find in the file or scrolling.

Well Rails and Django are amazing frameworks. This may or may not be true. Rails does have a lot of cool features. It is even cooler when you start giving it extra gems. I’ll give it that, but even that isn’t good enough for me. If you actually want to start using more complicated conditions, you end up writing the SQL you were looking to avoid. Something like Symfony provides most if not all of the commonly requested features for php. There are many other frameworks available too. So if one isn’t good enough, you can always try another.

PHP is slow. To be honest, PHP is usually not where scripts end up being slow. I frequently see one of the following: 1) Are you having PHP do calculations that your database could easily do? Why would you do that? 2) Are you having PHP parse pages that are static or virtually static? Why not use server side includes and not even use the php parse? 3) Did you make a huge data structure that you are recreating on every call? Look into functional programming or restful programming (both are stateless) and consider revising your code.

And in the end, PHP has a lot of well known ways to speed it up. Why not try out a caching solution? memcache is nice and well supported. You could even implement your own.

Are there any reasons to use PHP, not just defend it? YES! Plenty. Integrating kerberos authentication is extremely easy. There is a wealth of information about any common task. the PEAR/PECL code is common and usually easy to use. The wealth of code already available makes it a simple choice.