PHP Sucks

Chris notes that Theo has posted his Six Reasons PHP Sucks PHP Lightning Talk.

My favorite part:

Reason # 4: User comments on the online documentation.
Allows PHP to expose what are perhaps the worst most dysfunctional and retarded code samples.

Reason #5: PEAR.
Allows PHP to expose what are perhaps the worst most dysfunctional and retarded code…
…in an easily downloadable/installable format

If you aren’t laughing, you haven’t used PHP.

A scoping circle jerk

I’m a little confused about the lack of lexical scoping being a problem as PHP doesn’t have dynamic scoping (which is far, far worse IMO). Given the sort of problems PHP is designed to solve, it’s scopeless system works, though it does create strange hacks like passing array('classname','methodname') for callbacks.

(Then again, once you get used to it, the constructs are a lot simpler than closures.)

Sometimes it is PHP’s greatest weaknesses that makes its greatest strengths.

I love this comment

Here is a comment I read on Chris’s blog:

“I completely agree with lexically scoped variables and namespaces. Seriously. We need those.

My number 1 reason that I wouldn’t use PHP (or perl) in a heavy load environment is the lack of database connection pooling. 1 connection per Apache thread? That’s insane. That’s the one place Java will always beat PHP (or perl).”

My response

Pray tell, please enlighten us how connection pooling can only be done in a lexically scoped language with namespacing?

Yeah, a dedicated database connection for Apache process is totally insane! What a waste of my Oracle license limits that I didn’t pay for! Fuck, I should go install JBoss or dotNet because I might get a hypothetical performance gain on a high load database!

This is fucking brilliant! The reason Ruby on Rails doesn’t scale is because it lacks connection pooling on ActiveRecord. God, that’s it!

Someone should tell Rasmus I might run out of resources on my database because I don’t know how to edit my Linux configuration or install SQL Relay.

The sky is falling!

My mind is totally blown away with your razor sharp decimation of how PHP won’t work in a heavy load environment. You have convinced me:

I’m selling my shares of Yahoo! because when they enter a high load environment it’s going to die!

PHP is dead.

Long live Java.

I need to become a J2EE consultant like you.

Please, don’t let Reality hit you in the ass on the way out of this blog.

6 thoughts on “PHP Sucks

  1. Reason #4 should really be explained a little bit better to the non-php-adept, cuz’ the online, commented manual is generally viewed as a great enhancement to the programming landscape (was php the first language to get it?) and one of the reasons of the sucess of the platform.

    Reason #5 is a great provate joke, tough.

    Scoping is maybe not always needed, but its absence leads to sometimes funny results. See bug http://bugs.php.net/?id=38317&edit=2 for an example: is’nt a language that prevents sane usage of ‘$this’ as variable name a bit of a brainfuck?

    Just my 2c…

  2. I love how PHP guys have to bring up Java. It’s like how Harvey Mudd students always bringing up Caltech, or Caltech students always bring up MIT err… what a minute. Anyways the db connection pool guy is not the sharpest tool in the shed. He had this, um, illuminating blog about debugging javascript by using logging statements: http://dev.loadedguntheory.com/devblog/director/listpost/b5349120-f9ca-1027-b38e-00508df3c0f7/OGNHMZAYNJGTYTQ3MY03MTC3LTK3NTUTNJQ2ODQ3NME0MGUY.html.
    I would think a Java guy would know about debuggers. Heck, even PHP has a debugger heh heh.

  3. @Michael: Unfortunately, I wasn’t the one who brought up Java.

    In the original presentation, it was Theo. If you know Theo, he is as far from a “PHP Guy” as you can get. No this does not mean he is a Java guy.

    In the linked article, Chris is the PHP guy and Tim is the guy bringing into a very valid “Why PHP Sucks” argument a frivolous argument (connection pooling) coupled with a typically bullshit conclusion: “That’s why I use Java” (by this I can only assume he means J2EE since “Java” and “PHP” compliment, not compete.)

    It is like Socrates, the reason PHP people are wiser is because we know our language sucks.

  4. @Gaetano: That’s why I said the greatest weakness of PHP is it’s greatest strength. The online manual is a great enhancement to the PHP programming landscape and something that sets it apart from all other language. Some of the code in the comments on the other hand sometimes lead to some severely bad advice…

    There are some classics in there.

    Yeah, the $this stuff is strange. It borders on dynamic scoping, but neatly dodges it by making it explicit and illegalizing its use everywhere else.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.