Hacker News new | ask | show | jobs
by homersapien 4633 days ago
PHP haters are hysterical, I mean that in the clinical sense. It is powerful, flexible, blazing fast (relative, I know), and arguably the easiest (or at least most accessible) language to learn. Its flexibility is what generates most of the hate. It gives you the freedom to create some really bad/stupid code, which noobs inevitably do. But hating it because it will let you hurt yourself is like hating a table saw because it can cut your arm off.
5 comments

A table saw doesn't try to disguise its blade as the stop button...

My favorite bug to date? Uninitialized variables being interpreted as strings. That's the one I get to debug for clients on a regular basis. "Why can't I make this DB connection?" "Because you forgot to initialize the variable containing the database name."

I actually hate it because it's not flexible enough. I did a few years of PHP dev and maintenance after learning and using Perl first. There's enough superficial similarities that it really makes the warts stand out. Every time I wanted to simply use a map, grep, anonymous function, or multiple items returned from a function, I was reminded of how much better it could have been if a bit more forethought was put into it.
I'm not really sure it's fair to say that people hate PHP because of its flexibility. Many other languages are very "flexible", and much more so than PHP for some things (you're less likely to do dumb threading or malloc mistakes in PHP, for example).

I think it's because PHP has a much larger surface area of questionable decisions to attack. When your core language is very, very small (e.g. Scheme), you have less to criticize, but when PHP has everything and the kitchen sink, plus a lack of an overarching philosophy or standard, plus a broken core developers community, it simply generates many more hatable things.

I don't hate it, I just find it hilarious to have stuff like == and === ; the old 'mysql_real_escape' (I think now fixed) and other stuff like that.

I wouldn't want to engage in a big project in a language as unstable as that.

The obvious counter point is that most people who hate PHP quite like C. But C more closely fits your description of "freedom to create some really bad/stupid code" than PHP does. People hate it because it makes it more difficult to do things well, not because it makes it easy to do things poorly.