Why PHP Does Not Suck

By Deane Barker on February 21, 2006

A pro-PHP Rant: Harry Fuecks gives us a wonderful, glorious rant on why PHP is good, no matter how many beat-downs it takes — and it’s been beat down a lot lately. He starts with the simplicity and reliability…

There are smallish sites I own / run, built on PHP, which I don’t look at for months but are still, magically, running next time I go there — be it impression or not, PHP just keeps on running — restart Apache or reboot and it’s back without sysadmin effort.

…moves through database support…

What doesn’t get said is PHP may now have the best (as in most stable and feature complete) across the board db support of any of Perl, Python and Ruby […]

…then covers XML support…

One for Tim — XML support in PHP 5(.1) is excellent, thanks to libxml2. And it’s not just that the core parser is good, it’s that you’ve got multiple APIs in PHP to it, namely SAX and it’s faster “invert” XML pull reader, SimpleXML and DOM, as well as the supporting cast of XSLT etc

The whole thing is a great read, and one with which I totally agree.

Over the years, I’ve programmed in classic ASP, ColdFusion, ASP.Net (barely), Ruby on Rails, a little Perl / CGI, some J2EE, etc. I always come back to PHP, and I’ll never apologize for it.

Yes, function naming is all over the map, and it’s easy to write bad code if you’re prone to that, but PHP is a joy to program with and there’s no other platform on which I can get as much done in as little time.

What This Links To


  1. You can crank out plenty of goodness in PHP, but it’s much easier to write sloppy code with it, that’s my main argument. Rails forces you to follow the MVC model, so even the worst coders won’t produce utter crap. You’re not always going to find the best people to work on your product, so it doesn’t hurt to have nice redundancies like a smart framework.

  2. MVC is not always the best answer. In a lot of situations, a Model 1 solution is better.

    MVC means a lot of overhead and infrastructure stuff, just to get to the heart of the app. If you have a big app, then that’s time well-spent. But there are a lot of apps and situations that call for a quick, simple solution. PHP fills that hole nicely.

    Yes, if I was programming a big, well-defined “Web application,” Rails is good choice (.Net too, for that matter). But if someone just wants to spit some data out on a Web page, PHP can be tough to beat a lot of the time.

    And I guess I reject the argument that a language that “forces” you to code well is inherently better. Like I posted on earlier, if a language doesn’t enforce this, and you turn out crap as a result, then does the language suck, or is it just you that sucks?

    Don’t blame the language if you’re too lazy to write good code without being forced into it. And if you fear other people who suck, keep them away from your app.

  3. I have no qualms with PHP being used for quick and dirty stuff, I think it fills that niche spectacularly.

    Rails isn’t the language, obviously, so we’re kind of talking apples and oranges. You could write sloppy code in Ruby just as easily as you could in PHP, so you’re correct that it does come down to the programmer.

    The framework, though, does help you code better, I won’t concede that point. If you’ve never been exposed to a model that enforces data separation, you may not be familiar with techniques on how to not create a sloppy mess.

    If you’re forced to develop a site in a certain way, you begin to pick up techniques that can apply to any language. So, if for no other reason, that’s why the MVC model can be extremely useful even if you’re not building a large application.

  4. I don’t disagree with anything you wrote. But if you’re throwing frameworks into the mix, there are a half-dozen good, solid MVC frameworks for PHP. Probably none as slick as Rails (though Qcodo looks good), but there’s MVC there as well.

    The different is that with PHP, you can abandon MVC when/if you need to. I don’t think you can with Rails — it’s kind of built in.

    Can you code Model 1 apps with Ruby? You probably can, since there’s a mod_ruby extension for Apache.

  5. I do see what he’s saying about the xml support being passable, but you can’t call it excellent for general web work when you have things like:


    I know rails is worse on character encoding, but I think the rest have it covered.

    And I know actual functionality has improved in 5, (if not discoverability by the sound of it), but it still appears to be missing coverage of major parts of the world market.

Comments are closed. If you have something you really want to say, tweet @gadgetopia.