PHP's Problem

How’s that for a loaded title? ;-) First off, let me state that I am by no means a PHP hater. I’ve actually made quite a good living off of it, and unlike some people in other languages, I’ve never ended up on the streets homeless cause of PHP (yet).

I made a comment on Twitter about DHH’s PHP post.

@chartjes that’s sort of a backhanded comment, but it’s dead on… PHP is ok until you start getting big, then it generally gets ugly

He took that as a bash and decided to challenge me to a dual. We nominated seconds, planned to cross the river into New Jersey, then realized that Twitter without loaded pistols would probably be a much better solution. And that’s how the world’s first twebate was born.

My final tweet on the debate I think sums up my view of PHP right now:

[PHP]’s like that super smart slacker we all knew in HS. If it would just apply itself, it could be really great.

I’m not exactly sure what it needs to do to “apply itself” as a language. It could start by realizing “because we’ve always done it that way” isn’t a good reason not to change broken behavior. That’s what compatibility modes are for. It could also look to Python to see how everything as an object can be liberating unlike Java where it can hinder you. It could realize that extensions are the next obvious step for anyone trying to make PHP hum and make the command to load a function/module—whether it’s parsed or compiled—the same.

Every time I see a mysql_real_escape_string(), have to look up to see whether the string function I’m using has an underscore or not between str and what it does, or have to read a manual entry to figure out if my array function modifies the array I pass it or returns a new one I sigh and can’t help but be reminded by that anti-social kid in the back of the class, drawing furiously in his notebook. He was a genius, he just needed some encouragement and the guts to grow up.