a companion discussion area for blog.codinghorror.com

The PHP Singularity


“PHP is the Nickelback of programming” is not a good analogy.

Wordpress is the Nickelback of programming, and PHP is the electric guitar.


If your approach to a “new PHP” is as obtuse and scatterbrained as Stack Overflow, then I don’t think PHP is in trouble. Seriously, a family of sites rather than just having categories? Each site w/ its own rep total? And weird-ass badges and rankings of all different kinds? This “suite” of sites is like the web version of Donkey Kong 64 – packed with extraneous nuggets and low on core fun/usability.

If you truly manage to come up with something that competes with PHP and yet is more “pure”, I wish you all the best, and I’ll be first to extol its virtues. But I sure don’t see it happening.

I have a William James view on the issue of programming languages. Pragmatism is king.


Here we go again…
Maybe it does suck. You can certainly tell it was not designed by computer scientists. In many ways, it throws away years for programming language best practices.
This being said, what are the practical alternatives? JSP? Servlets? ASP? Python/Django? Ruby/Rails? What?
I am sorry but JSP, Servlets, ASP, Python/Django, Ruby/Rails are just shit of a different kind. But they do not deserve that holier-than-thou aura.
I suggest bad programmers keep blaming their tools for their own shortcomings. I suggest that when bad programmers have produced enough horrors to sully a tool, they blame the tool and move on to the next tool.




“Broken gets fixed. Shoddy lasts forever.”


I agree with @Adam Victor Nazareth Brandizzi. People do not care about the elegance of a language, they care about solving problems. I am a C# developer at work, and it is by far my favorite programming language. I spent time developing PHP applications in my career. From that time I learned I can write PHP in a way that makes me sane. Does PHP suck as a development standard, absolutely, is it going to be replaced for what it is, probably not.

There are good programmers, bad programmers and wannabes. I would love for the bad programmers to go away, but they won’t. Refer to your please don’t learn to code posting, and when you do look at PHP again and you’ll see that is their solution to your plea. It takes very little to learn in order to do something useful to the average person using LAMP.

There are languages I will never use because I just don’t like them for one reason or another: Ruby, VB, and Coldfusion to name a couple. I try not to bash them or the people who choose those languages even though I think there horrible. What I do is not use them myself and stay away from projects that would force me to use them. You need to stay away from PHP, and you can if you want to. Program and let program (live and let live); but teach the ones that want to be teached to be better and make better choices, which I think is one of your original motives to write this posting.

Just my two cents, thanks for the morning read.


Why do we need all these anti-php rants? I get the distinct impression that the authors of posts like this one have quit using PHP a few versions back and now that they feel all superior with their new found language they need to publish a work that secures their ego. Here are some facts (I found very few in Jeff’s post by the way):

A low barrier of entry is not a bad thing. Read Ian Landsman’s blog post where he mentions his 60 year old dad hobbying with PHP: http://ianlandsman.com/2012/06/29/PHP Can you easily tell a friend or new developer how to deploy a Python, Java, or Rails app? As for the argument of “terrible tutorials” on the web there are also thousands of great ones due to the high availability of PHP. Choose a reputable teacher.

PHP has changed since V4. I know, quite a shocker for those of you that left a few years ago. It’s now OOP. It has closures. Yay!

There is such a thing as beautiful PHP code. Check out the frameworks http://Laravel.com and http://FuelPHP.com

Wordpress is popular due to it’s early start. It is not a good representative of a PHP CMS. There’s a number of well coded CMSs out there. http://PyroCMS.com is one such non-spaghetti PHP CMS.

PHP has momentum, JavaScript has momentum. jQuery did wonders for JavaScript. There is nothing wrong with sticking with a language that has momentum and using tools to make you write great code.


You all need to get over the whole bad programmer/bad language thing.
Bad that works is not bad. If you think you’re getting paid to write code then you are the problem.

Programmers get paid to solve problems.
No one who matters in the solution space knows or cares how you get the job done as long as it does get done.

Mr. Atwood, please don’t mess up PHP the way Adobe messed up Actionscript.


Please, take off your hate glasses.

A chunk of the comments showed a lack of reading comprehension. Maybe if you read just two choice parts again( without your hate glasses ) you will calm down.

From the article:
“Is PHP so broken as to be unworkable? No. Clearly not. The great crime of PHP is its utter banality. Its continued propularity is living proof that quality is irrelevant; cheap and popular and everywhere always wins.”

Wait, What? PHP works? Off topic, anyone else spot the typo?

“What we ought to be talking about is not how terrible PHP is – although its continued terribleness is a particularly damning indictment – but how we programmers can culturally displace a deeply flawed tool with a better one. How do we encourage new programmers to avoid picking up the double clawed hammer in favor of, well, a regular hammer?

Don’t Attack! Offer Alternatives. BALDERDASH! :slight_smile:
Don’t force the guy already using PHP to do anything. Awe, come on! That’ll take FOREVER!

Thank you for the article Jeff. Lots of good links to read, and thoughts to chew on.


Great post.

@Jos3000 makes a good point. It might be far easier to make an interesting (read: not utterly banal) language that compiles to PHP than it would be to create yet another language (a real hammer) and make it so popular that its pervasiveness would make it attractive to the masses.

CoffeeScript is a good example of a language that compiles to JS and actually makes it a better alternative to plain JavaScript. And there is already a few languages that compile to PHP as well (Fructose, Pharen, HaXe). But none of them really convinced me so far. Still, I’m eager to see more of those compilers appear in the future. I believe there is a huge market for such a language.


One of the possible ways how to avoid PHP is to persuade hosting providers that hosting something else than PHP doesn’t have to be that complicated. Which might be one of the best things about my employer’s, Red Hat (sorry for pimping them, but I really have no other benefit from OpenShift than pure joy of writing real world Python), providing whole hosting platform OpenShift Origin and making it freely available (both beer and speach; https://openshift.github.com).

Otherwise, PHP causes me a deep long attacks of melancholy. How come that most interesting FLOSS projects which matter most (wordpress, owncloud, status.net) are writing in something like that? Is there any other evidence of presence of Evil in the world needed?



It seems like the real issue is not PHP itself as a language, but rather that the barrier to entry is so low (just put some PHP tags in a .php file and hack away) that a lot of what is written in PHP is cargo-cult copy/paste jobs by people who have no programming experience or training and have no idea what they’re doing.

If you make something else that has a barrier of entry as low as or lower than PHP’s, won’t the same thing just happen in that language? And if the barrier to entry of the new thing is even slightly higher, won’t people just continue to use PHP?


“What we ought to be talking about is not how terrible PHP is – although its continued terribleness is a particularly damning indictment – but how we programmers can culturally displace a deeply flawed tool with a better one. How do we encourage new programmers to avoid picking up the double clawed hammer in favor of, well, a regular hammer?”

…By informing them of why PHP is to be avoided, like Eevee’s blog did. And then subsequent posts on how to get started on Python (There are similar posts for other languages as well.)


Started with BASIC, learnt Pascal, switched to C, C++, learnt Java, then started web developing with Perl. Then, one day, we paid an external developer for a project in PHP. I knew nothing of it. We had to make small modifications, so I opened the files and looked at the source. It was an unknown language, but I could read it. It was sort of simple. It was sort of readable. Had no “How to start with PHP” course or tutorial. I bought books on Java, Javascript, C, 68K Assembly code, C++, SQL, Ruby, DHTML, Cocoa, ActionScript 1+2+3, and most shit out there… But thinking of it now, I never, ever, bought a single book on PHP! The online reference was incredible (today it is still a benchmark for others, in my opinion). In a few days not only I had made the modifications, but had started learning the new language in a way that allowed me to learn and become more productive while I worked. It sort of absorbed me. This implies writing better code while you go, yes, so the code you wrote before, is horrible compared to what you write later. But what I can tell is this: I still love PHP, I love the logic of it. Variables are variables, functions are functions (if you think this is obvious, think again). Accessing things inside arrays/objects is clear and simple (if you think this is obvious, think again). I definitely love PHP arrays. Now probably most newer languages have something as powerful, and you give it for granted, but the first love is hard to forget. Gosh, I even don’t dislike variable variables (i mean $$var)! Sorry, love is irrational, you can’t argue against it.


I honestly have no idea what you’re talking about.

PHP is terrible, but why do you need to consider it? I’ve never had the slightest bit of trouble finding hosting for other languages and tools. You can deploy a Python or Ruby or JavaScript web application to Heroku in like five seconds; if you get some cloud hosting from Rackspace or Dreamhost or EC2 it might take you as long as fifteen minutes.

This “available everywhere” thing is just a fallacy. I can’t think of a single platform that has PHP that doesn’t also have both Python and Ruby and a trivial way to get all your dependencies installed. And in fact, as much as the Python packaging ecosystem needs an overhaul, installing and configuring PHP dependencies for any non-trivial application is an enormous nightmare, especially if you want to install more than one thing on your web server! In Python it’s just virtualenv, pip install, and you’re done.

Maybe some hosting providers offer PHP but not other things, but you know what? Just don’t use those providers. There’s a huge, highly competitive market of hosting out there, and every part of it that I can see has excellent support for reasonable tools. Heck, you can deploy on Heroku for free.

Didn’t your parents ever tell you that if all your friends jump off a bridge, you shouldn’t jump off of it too? Well, PHP is that bridge. Don’t do drugs, Jeff.


Problem with PHP is not PHP. There are easy alternatives (Perl::Dancer, python::flask, ruby::ramaze).

And, this is exactly what you are calling for: a cheat sheet for php devs to code web app in python:

The problem with PHP is the lack of abstraction amongst PHP developers.
For them there is no differences between a float (an implementation) and a number (an abstraction), a char * and a representation of a string.

The problem with PHP is also the lack of knowledge of how computer works.
When they do abstractions, it is pitiful. Astronaut architects striking back (symfony, propel, doctrine…)

The problem with interacting with PHP devs is like being caught between a dysfunctional hammer and a dysfunctional anvil. Still, it hurts.


I’ve always liked the two headed “hammer” as an accidentally appropriate metaphor for most complaints about useful items, but the way I read it is:

  1. Pick up a nail puller.
  2. With certainty bolstered by limited knowledge decide to call it a hammer.
  3. Complain that it is not a very good hammer.


Sorry, I’m going to get flamed but what’s so wrong with Perl? PHP, the Personal Hypertext Processor was built on it, so some of the both the ugliness and utility leaked out from Perl origins.

I’ve been using and maintaining Perl, including some -big- codebases since about 1997 and it’s still a good language both general purpose and for the web. CPAN [which is both good and bad, huge amount of choice and huge amount of variable quality] makes it extremely productive as well.

On the other hand, as a young person I supported APL for quite a while, so I have a weakness for very terse, rich languages.


Adding a month to a UNIX timestamp, C vs. PHP: https://gist.github.com/3019006

That’s right: PHP managed to screw up a perfectly good C API. How do you screw up a trivial wrapper around a C function?

Sure, I can make this code clearer by asking for an associative array, but that’s not the default behavior. That still doesn’t let me pass the array back into mktime, for two reasons: mktime expects each element it cares about as a separate argument, and mktime doesn’t use compatible bases for the month or year.

This type of nonsense is spread out all over the language. Yes, things have improved with PHP 5 over 4. At least objects are passed by ‘sane reference’ now (there’s no other way to get a sane reference in PHP, so in 4 you were screwed unless PHP’s odd take on references happened to work out for you). PHP’s learned to fake it a little better, but it still does not behave like a reasonable language.

Sure, you can get work done in PHP, but I’m all for coming up with something better and using it wherever it makes sense.


I like the Nickelback analogy, though you could also say that PHP is the Windows of programming languages.