Hacker News new | comments | ask | show | jobs | submit login
Used PHP in a Hackathon was made fun of and it made me feel really shitty (reddit.com)
73 points by jocoda 9 months ago | hide | past | web | favorite | 79 comments

I have been using PHP professionally for 7 years now and I absolutely love it. The community grew up from the old days when I started playing with it (almost 15 years ago). There are incredible pieces of software built with it, and nowadays the language is unrecognisable from the state it was in when it gained the bad reputation. i think Symfony 4 is a wonderful framework and it allows us to use PHP to build things that most would think it's impossible in the language of spaghetti code.

Yes, there are still a lot o people out there that hack some very questionable code together in PHP but we shouldn't dismiss it like this. I've tried multiple languages (C#, Java, javascript) and I have to say PHP is my favourite so far (you guys can comment on this as much as you like, I still like it a lot).

It's disheartening to hear that in a hackathon people got "bullied" for using a programming language. You would never pick upon a mechanic for using a screwdriver instead of a chisel or something similar, as long as he can achieve the same thing.

Also, I can't help to notice a trend of ..."brogramming", where if you don't use the newest and coolest tech you're treated as an outcast, bullied and made fun of; it's quite sad if you ask me.

> I've tried multiple languages (C#, Java, javascript) and I have to say PHP is my favourite so far

All programming languages have short comings. The once you mention here even more so I believe :)

Picking a favorite out of a very small subset is mainly personal choice. If you are happy with the toolset and the programs you create, I think you made the right call.

> "brogramming", where if you don't use the newest and coolest tech you're treated as an outcast, bullied and made fun of

I see this too, but I believe it's more specific to web development. A lot of people program C and they are generally not bullied for that.

> nowadays the language is unrecognisable from the state it was in when it gained the bad reputation

I used it then (3.x, 4.x) and I recognize many of the terrible warts are still front and center.

PHP isn’t bad because it’s not new and shiny, it’s bad because it does opaque and wrong things and demands a user of the language know all sorts of inconsistent PHP-specific nonsense that does not benefit the language authors, the language users, or serve the solving of the problem of the language user. It’s not prejudice or signaling, it’s objectively deficient in ways that haven’t been acceptable in decades.

And then we have javascript, somehow people seem to think that is ok.

I much prefer PHP, also the warts are serverside which makes a huge difference.

> It’s not prejudice or signaling, it’s objectively deficient in ways that haven’t been acceptable in decades.

I don't want to start a useless debate or anything like that, so don't take this in the wrong way, but I am genuinely curious of what specific problems you see in PHP and what are the specific issues with the language.

I can't think of many things that are so bad with it, except the inconsistency in function naming and parameter orders (stuff like `str_pos`, `substr`) and a relatively unreliable SoapClient implementation; I am genuinely interested in seeing what other people think are deficiencies in PHP.

Again, I have to stress I am not being defensive nor offensive, I am just curious on other perspectives in regards to the shortcomings of PHP.

I am genuinely curious of what specific problems you see in PHP and what are the specific issues with the language.

There are so, so many. Here are some good references:



Disclaimer: I earn my income from a project largely written in PHP.

I'd like to second that! I haven't used PHP much since version 5, and while I'm inclined to believe that there's only so much that can be done to 'fix' a language that isn't particularly good, I'd love to hear how things have changed for the better, but also what problems still exist.

Much of my own work has been javascript, and I could probably write a similar comment about how much has improved and yet how much is still fundamentally unpleasant because of the initial design (and the need for backwards compatibility). Of course, enough has probably been said about that...

The one shortcoming that I ran up against repeatedly is the implicit initialization of variables to be a string containing the variable name. It turns typos from compile or run time errors into subtle bugs.

It's commonly known that PHP sucks[0], there's really not much to say about it.

Off the top of my head, the awfully inconsistent "standard library" (and kitchen sink) is a true nightmare (array_map vs. array_walk, wtf?) the absolutely hamfisted and counterintuitive autocasting (and no way to do strict comparisons besides equality), the disaster that is its "type system", leaking implementation details of the parser into (language) user space (T_PAAMAYIM_NEKUDOTAYIM anyone?) the absolutely intransparent difference between built-in functions, keywords, expressions, etc (can I use empty() here, or was did I have to use is_null, or any of the other half a dozen ways to express "does this exist?"), the list goes on…

PHP's design is anti-intellectual (on purpose) [1] and so PHP didn't even have an AST until version 7. It just emitted opcodes after lexing. Yes. It truly, amazingly did that, I couldn't believe it either, but there you go. This lead (directly or indirectly) to many faults in the language. It's also the core reason why PHP 7 is about 2× faster than PHP 5.x. Who knew you could optimize a parse tree before executing it?

If you want to find faults with any language, you can. With PHP, you can find more faults, and more easily. But the real problem is that those faults do kill productivity. I use PHP in my day job, but recently we've moved to doing more client-side programming in React. I get to use flow's type system which isn't perfect, but believe me, it's a breath of fresh air after coming from PHP. I'm not a fan of the JS ecosystem, but it's still better than PHP.

The community has made huge strides with PHP 7, and it's finally getting into some OK shape. The reason PHP is huge is because it made the right decisions at the right time. The threading model is dead-simple (there just isn't one) and requests are automatically isolated at a process level. No recompilation, no fuss (but then you forget to flush your opcache after deploying to production and everything explodes…) It's easy to get started with, and it's easy to make a simple thing with. It may even be the "correct" choice for a Hackaton. It most certainly is, if PHP is the language you're most comfortable with.

I'm too old to lead language flame wars. You can do great stuff with it, as you can with almost anything. It's not impossible to write good PHP code, it's very possible! But not because of PHP itself. PHP is an objectively bad language

Given the choice, I'd rather code in Java, or C#, or even TypeScript+Node.js. But I'm not, so I code PHP every day, and it's not like that's the worst thing in the world. It just feels like I'm fighting the language, instead of the language helping me.

[0] https://duckduckgo.com/?q=php+sucks

[1] "I was really, really bad at writing parsers. I still am really bad at writing parsers. We have things like protected properties. We have abstract methods. We have all this stuff that your computer science teacher told you you should be using. I don't care about this crap at all. " ~ Rasmus Lerdorf (yeah, sure, taken out of context, but the point still stands, and there is no dearth of interviews and quotes of his documenting the same general attitude.)

PHP has shortcomings, for sure. And I'd probably scorn at people for using it for production-grade, "serious" tasks, and I'd be sure to find some security issues within their code (it's not just php, it's the libraries AND the coding style it promotes).

But for an hackaton? 36 hours to get something done? It may be totally be the best tool for the job.

If the only goal is really gone in 36 hours the hackathons are at fault. I would absolutely hope to walk away with something of value for my 36 hours, and not a pile of throw-away code.

It has been a long time since "throw away the prototype" also meant switch languages, databases, production OSes, version control systems, and library code. Modern languages are flexible enough to let you prototype rapidly with sturdy languages, front end and back.

Experience comes in different levels. There's professional experience, for example knowing it is stupid to use a certain algorithm to solve a certain problem and then there's life experience, for example recognizing how pitiful language bashing is.

If it works, and you can write code which meets the spec quickly - then who cares?

I fell into this exact trap - Moved my org from PHP to what was "New and Shiny" -- and while it worked out, our prototyping / proof of concept speed isn't nearly as fast as it was with PHP.

Completely agree with you. In the last 5 years I wrote a lot of Javascript code in Node. For sure I can say that there is no great framework that give you the "completeness" that Laravel, Symfony or CakePHP give you.

I always made fun of php. No reason, I've never truly worked with it in depth and I'm also not the best JS dev. I never attacked a person for writing php I just mocked php itself. Even so, this made me feel bad and I'm going to change my attitude. Nobody should feel bad for doing something they enjoy. <3

I've used PHP and I too make fun of it. It's a silly language made years ago without a lot of attention paid to normal software development practices and it shows. There is a laundry list of facepalm-worthy things the language does.

But it's just a language. Good software is made in bad languages all the time. And making fun of PHP is not the same thing as making fun of someone who is using PHP. I'm sure Rasmus Lerdorf will happily tell you PHP is full of expedient design choices that would be different in hindsight, but that doesn't make it OK to poke fun at people trying to get work done.

There is plenty of activity within frameworks and on internals from people who are absolutely concerned with good software development practices.

Obviously it does suffer from some design issues due to backwards compatibility but is moving in the right direction.

Heck I make fun of PHP as much as I've made fun of JavaScript (maybe less actually) but now I'm heavily investing my resources at becoming a fine grained JavaScript developer, and I'm looking back at PHP all these years later because if I wanna "hack up something" in PHP I don't have to think about where to host it, you are totally spoiled by the offerings. Have fun trying to say the same about any other web framework / stack.

What if they enjoy writing non tokenized SQL statements with user input and without an ORM?

Some practices are bad. PHP was my first working language and I used it for years. I’ve since used a dozen other stacks in the intervening fifteen years. PHP is objectively a poor choice, an impediment to its user.

Someone who is told this, who doubles down on ignorance of better, more efficient, more predictable, consistent, safe, and useful languages, is worthy of ridicule—not because of their ignorance, but because of their will to remain ignorant.

Sorry, but that's just silly.

I might agree that PHP is a poor choice in many ways, and that in many situations there's a much better alternative. But it's quite another thing to claim it's "objectively" a poor choice.

I have clients on small budgets who run on shared hosting, and the fact that these support PHP is enough reason to use it. I have clients whose needs are met almost perfectly by Wordpress, and using it requires using PHP. I know developers who have fairly successful small businesses on PHP and for them it would be "objectively" a bad idea to just drop all their knowledge and everything they've built so far in favor of an "objectively" better language.

Even just the fact that in some places or for some use cases it's significantly easier and cheaper to get an decent PHP developer than anything else is a reason to use PHP for some things.

"Someone who is told this ..."

By an authority such as yourself? Sure aren't we the lucky fellas to have somebody like you to tell us what's what

> What if they enjoy writing non tokenized SQL statements with user input and without an ORM?

Those functions have been deprecated in PHP for years, and they were just wrappers around existing C libraries to begin with/

And other languages have that as well. I've seen it done in C# and C++.

I wasn’t talking about SQL in PHP, I was talking about people who like pursuing sloppy and careless software engineering practices in general, like writing unsafe SQL queries using string concatenation [in any programming language].

Using PHP is the same thing.

The story about FizzBuzz is not literally asking you to implement FizzBuzz. It’s an illustration.

My comment could be rephrased: just because many people like doing things that are bad does not mean that those things aren’t bad. It just means that many people are ignorant.

Plenty of ORM choices in PHP. Also PDO if you want to write paramatised SQL queries.

>... worthy of ridicule—not because of their ignorance, but because of their will to remain ignorant.

The ironing is delicious.

In my experience people making fun of technology X (for all X) only reveal their own lack of understanding of not only X but their own tools too. Every tool has its own advantages and disadvantages.

Fanatics of any kind always remind of this fragment of Zen and the Art of Motorcycle Maintenance:

> You are never dedicated to something you have complete confidence in. No one is fanatically shouting that the sun is going to rise tomorrow. They know it's going to rise tomorrow. When people are fanatically dedicated to political or religious faiths or any other kinds of dogmas or goals, it's always because these dogmas or goals are in doubt.

> In my experience people making fun of technology X (for all X) only reveal their own lack of understanding of not only X but their own tools too.

I find mocking X (for any X) to be occasionally educational https://www.youtube.com/watch?v=RGkIsUBfanQ

I love that talk, but for some reason I never found it to be mocking in a 'bad' way. Perhaps it's because all these bad things are so obviously bad that they're like 'the sun rising'.

> Every tool has its own advantages and disadvantages.

I agree with this, but only as a conversation starter, not a rebuttal-killer.

When I was a PHP dev I had a colleage who liked to say "the only tool nobody complains about is the one that nobody uses", as if that somehow makes all tools equal. Yes, all languages have flaws; no, not all languages will set the font colour to 33200000000000 because they guess that the string "332e11" should actually be treated as an integer written in exponential notation. Looking back, I guess it's a form whataboutism (although without any specific examples).

PS: I absolutely agree with (almost) everyone that personal attacks are absolutely unjustified.

Having doubt in one's dogmas sounds healthy.

So it's a thread in which people criticize tribalist behavior by engaging in their own tribalist behavior.

Sounds ironic, I say from my self-satisfied position of detached superiority.

I feel like the kind of people that go to a hackathon are the kinds of people that are looking for some sort of in-group/out-group dynamic, and programming language choice is the easiest way to decide who is in and who is out. When they get older they'll realize it's not worth the effort.

In my personal experience, people use PHP because it is the only thing that they were taught. NOT because they have considered options and have consciously decided to settle on PHP.

The same can be said for JavaScript. Even worse can be said of JavaScript, a PHP developer will have to learn JavaScript for any client side behaviour, whereas the entire JavaScript community has rebuilt large code bases to not have to learn anything else.

Node is pretty much the new PHP. JS is pretty easy to pick up, a lot of people know it, and then node was invented so that people could just write their whole stack in it. Apart from ‘I already know it’, most people would be hard pressed to come up with a reason why node was the best choice for their project. You can say the same about PHP, except... PHP is infinitely more fucked and nonsensical than JS. There’s no project where PHP is the best choice, or even a realistically defensible choice. It is also an enduring blight upon the internet. PHP apps are riddled with bugs and vulnerabilities.

Not true, I started off with Java, learned Objective-C, then PHP and finally JS (And by JS I mean Node) and today I still settle on Node for all my hobby project simply because it's so easy to get something up and running. However I wouldn't use it for a larger-scale project with a big team - but I wouldn't use PHP for that either. ;)

shrug I've built things in more than 10 languages and sometimes I consciously choose PHP.

That’s not necessarily true. I learned BASIC and C/C++ first, then Java, then six years of .NET, but almost only used PHP for the last decade because that’s just what’s used in the market I work in (e.g. content managed websites).

People are going to use what makes them money, and what makes the most sense for the project.

Thankfully when using the right frameworks modern PHP feels more like a real OO language instead of the clusterfuck it used to be.

This is so true. I used PHP for 4 years just because I didn't knew anything else. Now I know python, java, javascript, rust and my decision to stick at javascript was clear and prudent. Today I would never devil anyone for using php or whatever feels good for them.

Nothing's wrong with the good old PHP. In fact, it reminds me of my 2012 comment[0]. The website[1] proclaiming PHP as "most likely to be a fad" is, of course, long gone by now[2], while PHP thrives.

-- the old comment --

Particularly ironic is PHP ranking high for ``This language is likely to be a passing fad''. Given its 17 years of history and recent the recent progress with versions 5.3 and newer... whoever voted on this position either wasn't aware of PHP's actual situation and outlook, or was just being thinking wishful.

> Why does almost everyone know the language?

If anything, it is that almost everyone can dabble in PHP and ^C^V some code. IMHO real knowledge of PHP and its ecosystem seem to be quite rare -- judging by reading some published code, which was as generic and un-PHP as possible, and by [many clueless] comments [posted on] the official docs.

-- the old comment --

[0] https://news.ycombinator.com/item?id=4929143 [1] http://hammerprinciple.com:80/therighttool/items/php [2] https://web.archive.org/web/20170913184701/http://hammerprin...

How can you predict that language is a fad when it's powering wikipedia, facebook and wordpress, which accounts for a huge amount of total internet traffic, is beyond me.

long gone by now

The snapshot you linked in from September 2017...

PHP is great platform for prototyping, even better if you're experienced. I actually used PHP a lot for general purpose scripting and code generation because it was so easy and fast. Now I'm at node-land (I had no issues with PHP I just needed something with concurrency and PHP didn't have it at the time) for a few years but I still have great memories.

Do what you want (and what makes you most productive) and don't care about others :-)

BTW: What I especially love about PHP is its documentation, or sort of integrated stackoverflow. I can't remember any other platform having "recipes" integrated directly in the documentation (which in my opinion, is brilliant idea)

> I can't remember any other platform having "recipes" integrated directly in the documentation

This has good sides and bad sides unfortunately. There are some really questionable ideas in those comments and they're not always downvoted to death. Presenting them to the beginners on the same page as the official docs makes them trust and copy-paste solutions sometimes.

Yeah but I also believe it's important for beginners to learn by doing, even if it means doing wrong. There is no universal "good way" of doing software anyway and best practices and patterns can be harmful too.

Take java spring or ruby on rails for example, those are opinionated ways of doing SW but they are also big pile of complexity and sometimes you really need just read a file, transform it a little and output the result. I think those awkward examples and hacks are valuable too because you get involved in internals and you know then how the entire thing works under the hood.

I still find myself using PHP for really quick and dirty mostly-static stuff. It's still so liberating to write HTML with some snippets of code, FTP that shit somewhere, and have it just work.

> Now I'm at node-land (I had no issues with PHP I just needed something with concurrency and PHP didn't have it at the time)

Did you realize the V8 engine is single-threaded?

Isn't the whole point of a hackathon meant to be getting something quick and dirty up and running in limited time?

I think using PHP warrants extra points for style.

Isn't the whole point of a hackathon meant to be getting something quick and dirty up and running in limited time?

No, the point of a hackathon is to condition the Workers that unpaid overtime is not only normal and expected but also fun!

I would also add that people clearly got stuck in the past regarding their point of view of programing languages, PHP is a decent language nowadays, it's not PHP3 anymore... The same way JS evolved a lot since the days of IE6.

>I think using PHP warrants extra points for style.

Especially if literally everyone else is just using node + MongoDB.

> Especially if literally everyone else is just using node + MongoDB.

There's definitely a "narccissism of small differences" going on in programming languages.

PHP, JS, Python, Ruby, Perl are all basically the same (dynamically typed, imperative, interpreted, optional class-based-OOP, etc.). If a decision's been made to use one of these, then things like library availability and developer experience are probably much more important than particular language features or quality. Yet there's a whole bunch of fighting and in-group/out-group between these.

Likewise Java and C# are essentially the same thing (I think the lawsuit banning Microsoft from bundling Java had a big influence on their push for C#, rather than actual features of the language).

There also seems to be a certain level of incests among languages. I remember PHP had an RFC (request for comments) for adding generators to the language, seemingly because Python has them. I commented that it would be better to go with delimited continuations, since they're more powerful and could also use the same implementation as exception handling. My comment was not well received, presumably because delimited continuations would actually make PHP different from its kin, rather than even closer.

> I think using PHP warrants extra points for style.

I always feel like a "real" programming language debate should throw in the occasional curveball, like a Prolog interpreter embedded in Smalltalk or something. At least it would break the monotony. On a related note, why shouldn't a mars rover be programmed in TeX? http://sdh33b.blogspot.co.uk/2008/07/icfp-contest-2008.html

As much as I hate PHP, I'll never judge people simply because they use PHP. I know some very good programmer who code in PHP.

This is quite an interesting way of thinking. I saw somewhere that from the different thinks that you can be a snob about, one of them is a programming snob. Thinking that when you use one programming language, framework you are way superior than others. (I'm not saying that languages don't have superiority over each other).

But I think this is the same mindset that makes people think that they need to use ML to solve every problem, when actually you can solve it without it just fine. As has been discussed in an earlier post.

The best programming language is the one which can get the job done. PHP is a well established backend stack and in no way inferior to the latest sexy stacks

I guess I've made fun of php in the past, due to having felt pain in using it at a project, but I don't think even I would be a big enough jerk to do it to someone I didn't know in the a public space.

PHP started out as a personal project, not with some grand design to be one of the most used languages powering websites. So yes, there were things about the language that were objectively bad, and it'll never be completely on par with a language that was truly designed from the ground up, but so what?

Your knowledge and the requirements of the job should dictate the tools you use - not what's hot. If it works, scales to the extent you need it to, and can be secured, then great!

It's basically gets to the point that you either get your shit done, or you don't. I've seen a handful super smart developers starting to code in the newly Xish language, and don't getting to the finish line, either in time or at all. So, you should be proud of yourself for delivering MVP in a hackathon, assuming that that's what you did. When people make fun of you you should tell them to shut the fuck up. Again, as long as it works it can be written in pascal, cobol, assembly or asp native. When you grow up and get to deal with exponential growth, it will be your "rich's worries" to rewrite the code in the newly not mocked Xish lang.

Well, a hackathon's goal (and a life's goal, if you think about it) is to get things done. Just beat them at that. With any thing you might like and enjoy.

It's not because everyone gets crazy about those new Nike shoes that you should wear them too, just enjoy running.

Slack was built with PHP. And here's the article from Slack engineering https://slack.engineering/taking-php-seriously-cf7a60065329

I guess building quicker is more important than building better, especially in hackathons or in startups where you are testing the product-market-fit. That means, one can use whatever language/tool they are most productive with. Of course, if you are lucky and if you gain momentum, then you will have the resources to re-engineer it with the right language/tool.

Matthew 7:5, "You hypocrite! First remove the beam out of your own eye, and then you can see clearly to remove the speck out of your brother’s eye."

These particular people truly do lack self-awareness, to criticise PHP as JS users.

> to criticise PHP as JS users.

and as JS users using MongoDB as a data store.

Frankly, modern JS is roughly at the same level as PHP as far as language is concerned. What is messy is the variety of frameworks and the quality of some of them. The well-known PHP frameworks are by definition mature and stable. I can't say the same about JS frameworks though. The point is you create code using frameworks, not just the language itself.

It is not at the same level, you need a bignum library to make JS do even correct math, which is something a programming language should be able to do on its own. JS shouldn't be called a programming language but a scripting anomaly.

This passes for closures in PHP:

    function ($arg) use ($capturedVariable) {
        return 1;
I rest my case.

Wikipedia, openstreetmap, Facebook - lots of world changing projects were started by hacking something together in PHP.

...started in a vastly different landscape than today.

Lots of world-changing projects were written in FORTRAN or APL but that doesn’t make them suitable for new apps today.

Also, many world-changing projects that did succeed would have been rendered total failures had they chosen this pathological language early on.

Your examples do not support your point.

“Suitable” is a subjective term.

The best tool for a job is the simplest one that gets the job done and the one you know best.

Would I start a startup in PHP tomorrow? Probably not (not least because I don’t know PHP). But that doesn’t make it unsuitable for everything.

I have been cleaning up after horrible PHP programmers for years. It is a good living. I do internally debate whether MySQL is a worse choice than PHP, but it's moot because they are almost always found together in the wild.

PHP is awesome. We love it. Always flexible & fast and professional and structured on demand - totally depends on you what you make of it.

Your best response ? Win the hackathon !

Reddit won't load for me, I'm guessing the end of that sentence is "and it won"?

"Used PHP in a Hackathon was made fun of and it made me feel really shitty."

I'm not liking this new reddit, I can't even fold comments.

Really? There's no "[-]" in front of the user name?

I don't see it on my personal laptop on Firefox (Linux Mint), or on my workstation at work also using Firefox (Ubuntu 14 - no plugins).


WOW I can't believe this, I opened it up in Chrome and it works / shows the comment folding option. It astounds me how much Chrome is becoming the new IE in regards to functioning websites where I wont be surprised to see (or not see) more cross-browser issues when using Firefox instead of Chrome.

Can I have the web where everyone wanted to be backward compatible with all browsers back?

Edit 2:

Also wondering how this got published by Reddit and nobody noticed some basic site functionality missing?

Nope, just made him feel really shitty.

People's allegiances are tribal, and this kind of juvenile gatekeeping is probably only prevalent among teenagers and young college students.

I've never identified with a particular technology so strongly as to feel attacked when its flaws are pointed out, and vice versa, I have never felt the need to attack anyone personally based on the technologies they use. Some might be better for some tasks but not others, and that's the only thing that matters.

Experience shows that people who lack broad knowledge of several programming languages tend to identify as "language X developers" instead of developers as such. This enhances tribalism and creates pointless language wars. Any time somebody says that some particular language is the best choice for everything, or some other language is never the best choice for anything, they're just inexperienced and are trying to mask it with fake confidence. Except for Java of course, it's the worst.

I assume that last sentence is misunderstood humor.

PHP until version 5 was not great. PHP jokes and hate are always been lingering around. Part of the reason is that PHP started as a hack and that Rasmus, the "inventor" of PHP, has always been a bad frontman. You can read some of his quotes here: https://en.wikiquote.org/wiki/Rasmus_Lerdorf Almost every person that is a good SW engineer and like to code has problem with that philosophy.

The truth is that today PHP is a pretty good language. CakePHP, Laravel and Symphony have been pretty good frameworks from a SW engineering point of view. I haven't written PHP code in the last 5 years but I miss the development experience. Everything is by default stateless. Accessing a page always starts from a blank state. You edit and save a file and you can reload instantly the page with the new code. Of course "re-execute everything" can become quite expensive at runtime...

In general I think the modern PHP is hated without a reason. Its bad rep will be hard to overcome.

Applications are open for YC Summer 2019

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