Live data from Hacker News

Ask HN: Why do people hate PHP so much?

news.ycombinator.com

11–20 of 25 posts

Re: Ask HN: Why do people hate PHP so much?

#11
Mostly because the legacy of PHP as a toy project carried forward forever. Here's a great tidbit about why all the original functions have ridiculous, inconsistent naming schemes:

> "Well, there were other factors in play there. htmlspecialchars was a very early function. Back when PHP had less than 100 functions and the function hashing mechanism was strlen(). In order to get a nice hash distribution of function names across the various function name lengths names were picked specifically to make them fit into a specific length bucket. This was circa late 1994 when PHP was a tool just for my own personal use and I wasn't too worried about not being able to remember the few function names."

That's right: Every one of the original function names has a different character length because length was used as a lookup. There are a lot of clowny things like this that have never been stamped out of the language.

Add to that its history of being a beginner language that most of its early adopters sprinkled into HTML and where many people who mayyybe have no business being professional programmers started making a career out of it. This severely undermined PHP's credibility as a language for professionals even though good software can be created in PHP in the right hands.

That all said, I spent about year coding in Hack, and while the parts that still feel like PHP are annoying, it is awesome in so many other ways. Hopefully it either starts to unseat PHP or PHP turns into Hack at some point.

Re: Ask HN: Why do people hate PHP so much?

#13
Because people are stupid. And stuck in the 90's. That's the main reason. Other reasons include self-hatred for spending so much time on RoR's/Node's penis. That's definitely the second leading reason. Making less money then "stupid PHP programmers" cause they seriously thought they could develop real applications after learning JavaScript. That's pretty high on the list.

Look the bottom line is PHP has some weird issues (naming inconsistencies, parameter ordering, security issues with deprecated functionality, etc. etc.) but you can find issues on the same level with ANY language. Professional PHP dev's can consistently build large enterprise applications that are readable, scalable, maintainable and performant. Anyone who tells you otherwise is simply not familiar with the transformation that PHP and the community has gone through since version 5.3.

Re: Ask HN: Why do people hate PHP so much?

#14
I am also a developer with experience in PHP(Cake, Codeigniter) Python(Django) Ruby(Rails) according to my experience PHP isn't a bad language and i don't hate PHP its just matter of fact i don't prefer to work in PHP( or any of its framework ) the reason is RAILS offered so much to me in context of Rapid Application Development that neither of PHP's framework offer

This is what i thought

Re: Ask HN: Why do people hate PHP so much?

#15
post #10
post #8

Earlier quoted context omitted.

>The language seems to encourage poor practices like building query strings directly from remote input without the use of a true query builder. I won't entirely disagree with you on this, because there is still a ton of that code out there, but PHP has had true 'query builders' for a while now, and the mysql_ functions are being deprecated anyway.

It has them, but so many people don't use them. It's partly an issue with the language and partly with the community. One thing I learned from NodeJS is that the quality of the community around a language can matter more than the language. JavaScript is a crap language, but the NodeJS community and the base of available modules is just so good that it makes up for a lot of the language's faults. When I tried it out I…

That's true.

There are a ton of features in modern PHP which address a lot of the common criticisms brought against it. Doing a proper comparison with other languages (framework to framework, not framework to language) I think PHP measures up reasonably well.

But there is so much terrible, legacy code out there. The evolution, if it's happening is happening very slowly.

Re: Ask HN: Why do people hate PHP so much?

#16
PHP gets a lot of hate because of internal inconsistencies and sometimes bizarre pass-by-reference semantics, but I mostly get annoyed at how dog slow it can be.

When PHP is fast (and it often is!), it's because the functions you're using are written in hand-tuned C. The kind of "modern PHP" that I write professionally (think Java or C# without types or a compiler) is often disappointing performance-wise.

HHVM is slowly proving to the word that this is not due to PHP itself but to the Zend runtime, but it'll be a while before HHVM takes over.

Re: Ask HN: Why do people hate PHP so much?

#18

It's interesting to read all these comments and more interesting for me to constantly be hearing "But hey, Facebook's built on PHP".

That's mostly because PHP made sense at the time that decision was made - by the time it didn't they had too much legacy to make a complete rewrite worth it. Instead, they chose solutions that wouldn't require a complete rewrite by creating HHVM[1] and Hack[2].

And remember PHP was only used for the user-facing stuff (they probably had more Java and C++ than PHP when they began moving to Hack) - if you look at what they open source[3] only about half a dozen (out of over a hundred!) projects are PHP.

[1] https://en.wikipedia.org/wiki/HipHop_Virtual_Machine

[2] https://en.wikipedia.org/wiki/Hack_(programming_language)

[3] https://github.com/facebook

Re: Ask HN: Why do people hate PHP so much?

#19
post #8
post #7

Inconsistency, very prone to security mistakes, poor type system, and some people just find its syntax "ugly." For example lots of folks hate $strings and $_WTF['bbq'] type syntax. Perl is another language whose syntax draws a lot of haters. I'd say the second problem is the most objectively bad. It is very easy to write PHP code that exposes you to all kinds of known exploit classes like SQL injection, command injec…

>The language seems to encourage poor practices like building query strings directly from remote input without the use of a true query builder. I won't entirely disagree with you on this, because there is still a ton of that code out there, but PHP has had true 'query builders' for a while now, and the mysql_ functions are being deprecated anyway.

I think that the fact it has taken this long to even deprecate, let alone remove, utter garbage like these functions is a prime example of why PHP is often reviled.

It almost makes you wonder if the point isn't to keep catering to bad programmers' whims just to keep from losing the 50% of PHP's community that would never be able to write software at all if they weren't working in a language that enabled them to ignore every best practice from the past 20 years.

I kid, I kid. Mostly.

Re: Ask HN: Why do people hate PHP so much?

#20

I am also a developer with experience in PHP(Cake, Codeigniter) Python(Django) Ruby(Rails) according to my experience PHP isn't a bad language and i don't hate PHP its just matter of fact i don't prefer to work in PHP( or any of its framework ) the reason is RAILS offered so much to me in context of Rapid Application Development that neither of PHP's framework offer This is what i thought

I don't like PHP, and I do love Rails, but pretty much anything you compare to CakePHP is going to seem fantastic.
Post reply on HN