TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Why do people hate PHP so much?

12 pointsby udswagzover 10 years ago
I am a web developer and can code in PHP, Javascript and Python. I still can't fathom why people hate people so much.

14 comments

feedjoelpieover 10 years ago
Mostly because the legacy of PHP as a toy project carried forward forever. Here&#x27;s a great tidbit about why all the original functions have ridiculous, inconsistent naming schemes:<p>&gt; &quot;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&#x27;t too worried about not being able to remember the few function names.&quot;<p>That&#x27;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.<p>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&#x27;s credibility as a language for professionals even though good software can be created in PHP in the right hands.<p>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.
评论 #8921378 未加载
apiover 10 years ago
Inconsistency, <i>very</i> prone to security mistakes, poor type system, and some people just find its syntax &quot;ugly.&quot; For example lots of folks hate $strings and $_WTF[&#x27;bbq&#x27;] type syntax. Perl is another language whose syntax draws a lot of haters.<p>I&#x27;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 injection, cross-site scripting, etc. The language seems to encourage poor practices like building query strings directly from remote input without the use of a true query builder.<p>PHP also has a problem that it shares with JavaScript and to a lesser extent Java -- the quality of the user base and user-contributed code is often very poor. If you look for PHP code on StackOverflow or Reddit or similar sites, you are likely to get something that is horribly wrong, comically inefficient, or whose use will immediately introduce a dangerous remote security vulnerability. This comes from the simple fact that it&#x27;s often a beginner language, so you have a lot of inexperienced people participating in forums and contributing sample code.
评论 #8912390 未加载
davidwover 10 years ago
I&#x27;m a web developer too, and I&#x27;ve worked with PHP professionally. It&#x27;s not a great language in terms of features, but there are worse.<p>One of the good things about PHP is that it has a very low barrier to entry, making it easy for people to get up and running.<p>I think, though, that that sometimes leads to one reason why people dislike it: a company gets up and running (which is a good thing) on a hideous pile of crap codebase (not so good) and then decides to hire some more serious developers.<p>I&#x27;ve been in that position, and it is not fun.
ts-jondinover 10 years ago
Inconsistency, would be my topmost argument, in general. Among many other things these include what PHP dodges under the term &quot;language construct&quot; which when searched produces a wikipedia stub article with the only examples in PHP.<p>Failed closures that lack proper scoping, while they have been improved the underlying problem remains.<p>Continuation on inconsistency is that functions are not first class even though the syntax is the same for closures:<p>function foo () { } &lt;--- This is a function<p>$foo = function () { } &lt;--- This is a closure<p>Inconsistency; Cannot access functions (closures) directly from arrays.<p>$list[&quot;something&quot;] = function () { };<p>$list[&quot;something&quot;]() &lt;- fatal error<p>What is &quot;truthy&quot; and what is &quot;falsy&quot;, not unique to PHP but that doesn&#x27;t mean PHP should do it.<p>Assumptions such as how it interprets numbers in octal<p>Functions do not follow any specific naming standard, i.e. some array functions are prefixed by array_*, some are not.<p>Include and require scoping is messed up as anything that is not a variable is mashed into the global scope.<p>Lastly in my post but far from all issues with PHP; A crap-load of legacy because &quot;we can never break anything&quot;
giaourover 10 years ago
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.<p>When PHP is fast (and it often is!), it&#x27;s because the functions you&#x27;re using are written in hand-tuned C. The kind of &quot;modern PHP&quot; that I write professionally (think Java or C# without types or a compiler) is often disappointing performance-wise.<p>HHVM is slowly proving to the word that this is not due to PHP itself but to the Zend runtime, but it&#x27;ll be a while before HHVM takes over.
评论 #8944283 未加载
sarciszewskiover 10 years ago
I&#x27;ve asked the same question before, and the answers I&#x27;ve received are basically:<p>A) People like to compare frameworks (e.g. Rails) to the PHP programming language, rather than an apples-to-apples comparison, and therefore PHP always falls short in their eyes.<p>B) The abundance of poorly written, insecure legacy code has besmirched PHP&#x27;s reputation beyond repair, even if its actual security isn&#x27;t bad.<p>C) The fact that n00bs can pick it up quickly and get a dynamic website out of PHP with minimal effort leads elitists to look down on it from their glass enclaves.<p>D) Academic reasons that no one outside academia cares about.<p>Full disclosure: I read and write PHP every day regardless of what people say about it. :D
franzeover 10 years ago
<a href="http://php.net/manual/en/language.types.array.php" rel="nofollow">http:&#x2F;&#x2F;php.net&#x2F;manual&#x2F;en&#x2F;language.types.array.php</a><p>&gt; An array in PHP is actually an ordered map.
haidraliover 10 years ago
I am also a developer with experience in PHP(Cake, Codeigniter) Python(Django) Ruby(Rails) according to my experience PHP isn&#x27;t a bad language and i don&#x27;t hate PHP its just matter of fact i don&#x27;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&#x27;s framework offer<p>This is what i thought
评论 #8914946 未加载
frostmatthewover 10 years ago
I&#x27;d suggest reading <i>PHP: a fractal of bad design</i> <a href="http://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/" rel="nofollow">http:&#x2F;&#x2F;eev.ee&#x2F;blog&#x2F;2012&#x2F;04&#x2F;09&#x2F;php-a-fractal-of-bad-design&#x2F;</a>
评论 #8922539 未加载
评论 #8912170 未加载
LarryMade2over 10 years ago
Take your pick (probably a combination of the below):<p>1) it is more popular then what they are using, developing or have skills for<p>1a) they use language x which does something different that they feel PHP sucks because the lack of it.<p>2) they got stuck using it and prefer language y instead.<p>3) They really aren’t all that good programmers and rely on pre-implemented security features to save their butts, and PHP doesn’t meet their dependencies<p>4) they are invested-in or represent language&#x2F;platform x and PHP is a compelling contender.<p>5) they prefer to argue instead of fostering as accessible&#x2F;usable alternatives for for one reason or another<p>Just as COBOL, FORTRAN, Visual BASIC, Perl, etc. are reviled by some, they still get jobs done. In some respects it may suck, others it&#x27;s just fine partly based on intended application and&#x2F;or coding skill.<p>If PHP was so bad in all the respects argued, there would be a much more compelling alternative, but it isn&#x27;t all that bad, and actually quite useful... and popular.
deekarmaover 10 years ago
It&#x27;s interesting to read all these comments and more interesting for me to constantly be hearing &quot;But hey, Facebook&#x27;s built on PHP&quot;.
评论 #8914858 未加载
mfc5over 10 years ago
Here&#x27;s a whole list of reasons: <a href="http://phpsadness.com" rel="nofollow">http:&#x2F;&#x2F;phpsadness.com</a>
sighsighsighover 10 years ago
Weak refs are a joke in PHP. All problems stem from that.
ryanloringover 10 years ago
Because people are stupid. And stuck in the 90&#x27;s. That&#x27;s the main reason. Other reasons include self-hatred for spending so much time on RoR&#x27;s&#x2F;Node&#x27;s penis. That&#x27;s definitely the second leading reason. Making less money then &quot;stupid PHP programmers&quot; cause they seriously thought they could develop real applications after learning JavaScript. That&#x27;s pretty high on the list.<p>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&#x27;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.