Hacker News new | comments | show | ask | jobs | submit login
You use PHP because you don't know better. (adambard.com)
27 points by Gonzih on June 20, 2013 | hide | past | web | favorite | 27 comments



I'm a Rails developer, not a PHP developer (well, I can do it, but when I catch myself doing anything more than editing a WordPress theme I stop and ask what went wrong). That said:

+ PHP is universally supported, virtually out-of-the-box, on virtually every architecture, distribution, web server, hosting company, etc etc etc you could name.

+ The deployment story for PHP apps is better than it is for e.g. Rails apps, particularly if you have, um, people who are not primarily technical in charge of it. For example, if you can follow instructions, you can install WordPress, and it will take you about five minutes. Given a functioning Rails application and told to put it on the Internet, and assuming you're a competent systems engineer, allocating an afternoon to the project is not a bad idea at all. (Unless you already have made the upfront investment in e.g. Chef/Puppet/etc scripts to configure everything your app will need to get running. I have a project where I haven't, but I've got pretty good documentation on what needs to be done to bring up the whole environment, and it takes me 2 to 3 hours to do.)

+ Programmers are rare. Programmers close to your are rarer. Programmers close to you willing to work for what you're willing to pay are rarer still. Yadda yadda. All of this is true about PHP programmers but they're about an order of magnitude or two more common than e.g. Rails programmers.

+ Even if we concede that PHP is a language comparable to duct tape and bubblegum, I've got to point out that a lot of the world just needs duct tape and bubblegum. There is a web service running at my old day job, where hitting a URL is supposed to tell you when the most current backup of the database was taken, and that's it. It is written in PHP and was coded, tested, and deployed live in approximately as much time as writing this comment took. Rails -- which I love! -- is not a very good hammer to hit that nail with. (I've got an app or two on Sinatra internally, and while I like them, they feel inferior in this case to "We already have Apache up. Copy/paste one file and forget this was ever a task.")


Thanks for this, you've renewed my faith in HN (and Rails developers ;) ).


If I may be so bold as to synopsize patio11: Choose your tools pragmatically, for each job.


This is just a rant.

People use PHP because they like it, or they're paid to use it or for any other variety of reasons. To argue it's because they don't know any better assumes the predicate.

People can rag on the language, but this post calls into question the intellectual horsepower of those writing the code, and I think that's unnecessary.

To wit, I'm sure it felt great writing this post, knowing how elegantly one can take down the practitioners of a craft without sounding exactly like a troll.


Oh, good. PHP 5.5 was released, and there wasn't a companion "PHP is Bad" rant up! I was getting worried that the HN community would fail. But no, no, this is good. Now, we just have to wait for the inevitable debate between PHP and Rails (and then the complaints about languages and frameworks), Python and Node.js thrown in for good measure, and someone to complain about array functions needle/haystack and string functions haystack/needle ordering problems.

Makes me happy knowing all is right in the world.


The rants will stop showing up when PHP's language design and runtime behaviour becomes consistent and predictable.


Maybe you enjoy reading pointless, worthless rants about PHP's "language design" and other problems. However, I'd like to keep reposting garbage to a minimum.


I share a lot of same sentiments as the author and I've had experience with a few more languages. The arguments I get from my friends are that "It's the most popular language on the web" and "Facebook uses it so it can't be that bad." All of those to me just fall into the title of this post: You don't know better.

I've shown a few of my friends Node.js and now they are on the same page with respect to PHP. One thing I've learned is that people don't want to learn until they are ready to learn so bashing their language never helps. I take the approach of trying to show them how to do something (usually with a video chat and start from scratch quick demo) in a better language framework and show them how it's less code, easier to test, easier to debug, better MVC framework, and faster execution. That's how I've won hearts and minds.


Interesting rant. Some of the things the OP takes as disappointing, or as a design flaw, I see as a good thing.

I've no problems with string concatenation. In fact, I consider overloading + as a concatenation operator to be risky in a duck-type environment. You could, conceivably, concatenate two variables when you meant for a mathematical operation to occur just by the type of the first variable.

I find things like $var->$foo and $var->{'duck_' . $i}() to be very powerful and good. Dangerous in the hands of an amateur, yes, but very effective when you know what you're doing.


I always find the string concat operator argument a little hilarious. It's just '.=', one extra character that somehow merits 1000's of word written on how much it sucks.

And being able to do $myvar(), or $$myvar(), or $$myvar[0](), etc is absolutely awesome.

Programming in general is dangerous in the hands of an amateur; I'm just happy that I have the freedom to make these mistakes.

In regards to the require/ include operation... spl_autoload, and additionally PSR-0, exists for a reason.


>You can argue that PHP is easy, and you won't hear a peep from me. PHP still exists because, to this day, I can spend $5 on a cheap shared host, upload a PHP file, and see a website. I have no doubt whatsoever that the continued existence of PHP is thanks to the widespread adoption of Apache and mod_php. >But I've never heard an argument that PHP is a good, or even acceptable language, except from a) those with a deep investment in PHP, and b) those who have never used anything else.

It's funny/sad how closely this mirrors my feelings about Javascript


Javascript is a much, much better language from a design perspective than PHP. However, that being said, Javascript definitely has some pretty major warts.


There are already lot of things that can be compiled to JS, so terrible javascript can be used only as some kind of assembler for the web. And at least JS has powerful fast runtimes.


Thing is, a lot of people doesn't care about all those things, and for them, being able to get a website out quickly and easily is the most important thing. In most cases, websites aren't super well engineered software. Most of them doesn't do much other than taking data out and render them as HTML. Given a decent PHP framework (or heck, even WordPress), almost everything is done for you.

Software is just a mean to an end, and well, most of the time. Not all websites needs a super well engineered language to build. Not all "programmers" get to work on exciting problems that make them fill pages of their notebook and think for hours for a few lines of code.


Meh article. It's quick to implement easy web front ends, will talk to just about anything, has easily accessible documentation, has a huge, free support network and doesn't get in the way.


PHP is simultaneously the worst and best language I've ever used. I think of it as the c++ of the web. It excels in leaps and bounds at doing the one thing I need to do (getting my idea prototyped in real time as I think about it) so much so that I can overlook the warts that really bother me (like not being able to use [] notation after a function that returns an array?!) The numerous other problems with operators and true/false don't really bother me so much because most languages fall down in one way or another. And people are completely mistaken about the @ operator. I wish more languages had a simple way to bypass errors and just do what I want them to do (or not). The Go language seems to be on the right track about this and I imagine someday we'll think of the @ approach as running a function without examining its error code, in an environment free of exceptions.

I can sympathize with his sentiment though. I hate objective-c more than any other language I've ever used (except visual basic), partly because it's so popular. I see so many problems with objc that I'm flabbergasted people can get so emotionally attached to it, to the point of becoming defensive if I criticize it.

Perhaps some of the vitriol is due to these languages pretending to be something they're not - low level - when really they are just glue between more powerful components. In that sense, I wish they would just be full blown liaisons and do more work for me, instead of rigidly forcing me to fall into the conventions that handcuff me in more "formal" languages. PHP is not so much a language as a preprocessor. If it only had macros.. that's the one failing that really stings, although if it did, it would quickly devolve into something unreadable like perl, so perhaps it's for the best..


> I can overlook the warts that really bother me (like not being able to use [] notation after a function that returns an array?!)

5.4 already added that.


I don't know a single PHP fanboy but I know good developers who maintain PHP applications, know and hate all the problems of PHP mentioned in the article, and many more. However, existing PHP applications fulfill needs in the businesses that use them. Maintainance developers deserve respect for what they do, not the blame for decisions made a long time ago by somebody else.


Most of the arguments i've heard against PHP (not all, but most) seem to amount to 'PHP is doesn't semantically resemble this other language I prefer and therefore it needs to die.'

Meanwhile the arguments for tend to resemble 'it works better than that language at deploying html anyway.'


For a PHP rant this was quite disappointing.


Also brings absolutely nothing new to the debate, the same tired points over and over again.

It always strikes me as a form of hipster-ism, if a language is widely used (particularly) in the enterprise it has to because "people don't know better".

Even the title is condescending, "You use PHP because you don't know better".

Really?

Ok, take my case. I'm 33, I've programmed since I was 7, for money since I was 14, I've programmed in everything from z80 assembly through C, Turbo Pascal through Delphi and Visual Basic into .Net and Python.

In my late 20's I went back to school and got a degree in Software Engineering.

If you feel the need to insult others you know nothing about because of a language they use without knowing why they use that language then you are an idiot (in my opinion).

I've seen beautiful code written in Visual Basic that delivered real value and absolute monstrosities written in Python.

My latest (and quite large project) is written in PHP but hey I don't know any better.


Someone who doesn't like PHP... maybe there's a cave that these people can huddle inside ranting about it, because no one gives a shit.


I didn't see anything new in this rant. Was this just a summary of the other "PHP is bad" posts that have crept up in the past 12 months or so?


Not this again...


What a silly post.


Boring linkbait.


You know nothing John Snow.




Applications are open for YC Winter 2019

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: