

Ask HN: Why PHP is so hated or criticized? - t3rcio

I am student and i am trying to be a good professional developer. I have seen with high frequency several criticism to PHP. Course, i already saw that PHP has a lot of defects, but other languages has yours defect too. So, why PHP is so hated? Is a bad idea study PHP?
======
onion2k
Prior to PHP 5.x the language lent itself to writing terrible code that got
the job done but little else. Consequently lots of very, very bad
(unmaintainable, unreadable, overly complex, spaghetti code, untestable, and
generally slow) PHP apps exist (I say that as a PHP coder with more than 10
years experience in it). The thing is though, as bad as the language is, the
problems are really down to the developers - you _can_ write good PHP code and
you have been able for a few years. Some frameworks (CodeIgnitor, Laravel,
etc) actually push you towards writing reasonable decent code - as much as
Rails (Ruby) or Express (Node) at least.

I suspect if there were as many Ruby devs as there are PHP devs you'd have
just as many articles decrying Ruby, when they really ought to be decrying bad
developers regardless of language.

------
jtreminio
I've noticed that on HN, in particular, many commenters "dislike" PHP due to
misconceptions or very outdated information they have about the language.

I've responded to people who didn't realize PHP has had first-class objects
for years, has a very good community-driven package manager, is easy to unit
test, scales very easily and very well, and has nifty features like closures
and traits.

In short, it's mostly people who have no idea what they're talking about
complaining about a language they've either never used or used years ago when
it was completely different.

That said, there are a few people around here who have proper criticisms about
PHP that doesn't center around "the order of parameters is too hard to
remember!". YMMV.

------
xauronx
It's definitely not a bad idea to study PHP. That being said, I tend to think
learning anything is a good idea (even a bad language would teach you
something valuable).

It would seem you're definitely conscious of the disdain toward PHP. I would
certainly keep that in mind if you find yourself applying for a job. If you're
going to apply to a trendy (uppity) start up in California, the kids there
will probably laugh at you if you have PHP listed before Node.js.

Study PHP, but on a framework with some sort of built in architecture. It's
possible to write entire apps with all of your logic spread out willy-nilly
throughout the view.

~~~
jtreminio
> If you're going to apply to a trendy (uppity) start up in California, the
> kids there will probably laugh at you if you have PHP listed before Node.js.

Yeah, this is the kind of shop you really don't want to work for.

edit: also,

> Study PHP, but on a framework with some sort of built in architecture. It's
> possible to write entire apps with all of your logic spread out willy-nilly
> throughout the view.

This is terrible advice and you should stop giving it.

~~~
xauronx
Just saw your edit. What's the terrible advice?

------
je_bailey
Popular languages are always the focus of criticism. The more popular the
language is, in terms of usage, the easier it is to find examples that you can
disparage.

Here are some of the larger websites and what they use
[http://en.wikipedia.org/wiki/Programming_languages_used_in_m...](http://en.wikipedia.org/wiki/Programming_languages_used_in_most_popular_websites)

As for studying it, I wouldn't make it the sole language in your toolkit but
if you enjoy it study it.

------
drill_sarge
Because php is widely used to make absolute ugly garbage. It may not be the
language itself, but a lot of people saying: "hey I can write 10 lines of
terrible php crap which somehow kinda works, I am web dev now!". There are
tons of people out there like this.

------
heldrida
PHP is hated if you are a Ruby developer and you've got nothing to do.

If you have the time, test RoR vs Laravel, that's a very good study :)

------
spabby
It's because most PHP developers don't wear pork-pie hats or media glasses.

