Feb 21

Why PHP Does Not Suck

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.


Comments

by PJ Hyett,   February 21, 2006 2:05 PM  

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.


by Deane,   February 21, 2006 2:25 PM  

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.


by PJ Hyett,   February 21, 2006 2:52 PM  

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.


by Deane,   February 21, 2006 3:08 PM  

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.


by PJ Hyett,   February 21, 2006 4:09 PM  
Can you code Model 1 apps with Ruby?

Certainly, but I wouldn't use it for that. PHP is the clear winner for Model 1 sites :-)


by bob,   February 21, 2006 5:07 PM  

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:

http://minutillo.com/steve/weblog/2004/6/17/php-xml-and-character-encodings-a-tale-of-sadness-rage-and-data-loss

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.



Add Comment


Want to advertise on this site? Contact FM.
Web Hosting Web hosting, dedicated servers and Web design services
Laser Toner Cartridges UK laser toner, toner cartridges, hp toner, lexmark toner, samsung toner, canon, toner, epson toner, oki toner, kyocera toner, xerox toner, remanufactured toner, compatible toner
Direct TV Deals Free 4 room direct tv deals. no equipment to buy. free fast professional direct tv installation. this is the best direct tv deal available anywhere.
SEO Article Learn from the experts with our SEO article.
rope light Shopping with birddog distributing, inc., gives you access to the lowest prices, the best customer service and the quickest delivery times possible.
Laptop AC Adapter We offer genuine factory direct replacement AC adapters.
Direct TV Best satellite TV deals.
Direct TV Deals Direct TV programming deals are varied and include packages containing from 50 channels up to over 250 channels.
8mm film to DVD Retain family memories with the only frame by frame digital restoration service in the United States for your 8mm film to DVD today
Rubber Stamp Shop for custom self-inking stamps, hand stamps, address stamps, label stamps, check endorsement stamps, check deposit stamps, date stamps, pre inks, pocket stamps, ink and much more!