TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: Why PHP is so hated or criticized?

1 点作者 t3rcio超过 11 年前
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?

7 条评论

onion2k超过 11 年前
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 <i>can</i> 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.<p>I suspect if there were as many Ruby devs as there are PHP devs you&#x27;d have just as many articles decrying Ruby, when they really ought to be decrying bad developers regardless of language.
jtreminio超过 11 年前
I&#x27;ve noticed that on HN, in particular, many commenters &quot;dislike&quot; PHP due to misconceptions or very outdated information they have about the language.<p>I&#x27;ve responded to people who didn&#x27;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.<p>In short, it&#x27;s mostly people who have no idea what they&#x27;re talking about complaining about a language they&#x27;ve either never used or used years ago when it was completely different.<p>That said, there are a few people around here who have proper criticisms about PHP that doesn&#x27;t center around &quot;the order of parameters is too hard to remember!&quot;. YMMV.
xauronx超过 11 年前
It&#x27;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).<p>It would seem you&#x27;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&#x27;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.<p>Study PHP, but on a framework with some sort of built in architecture. It&#x27;s possible to write entire apps with all of your logic spread out willy-nilly throughout the view.
评论 #6808278 未加载
je_bailey超过 11 年前
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.<p>Here are some of the larger websites and what they use <a href="http://en.wikipedia.org/wiki/Programming_languages_used_in_most_popular_websites" rel="nofollow">http:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Programming_languages_used_in_m...</a><p>As for studying it, I wouldn&#x27;t make it the sole language in your toolkit but if you enjoy it study it.
drill_sarge超过 11 年前
Because php is widely used to make absolute ugly garbage. It may not be the language itself, but a lot of people saying: &quot;hey I can write 10 lines of terrible php crap which somehow kinda works, I am web dev now!&quot;. There are tons of people out there like this.
heldrida超过 11 年前
PHP is hated if you are a Ruby developer and you&#x27;ve got nothing to do.<p>If you have the time, test RoR vs Laravel, that&#x27;s a very good study :)
spabby超过 11 年前
It&#x27;s because most PHP developers don&#x27;t wear pork-pie hats or media glasses.