Hacker News new | past | comments | ask | show | jobs | submit login
[flagged] PHP: A fractal of bad design (2012) (eev.ee)
16 points by nateb2022 on Jan 21, 2024 | hide | past | favorite | 17 comments



Zzzzz tired about this heavily outdated article. Let it RIP for good sake, POS that the author never updated what a joke.


This article is so obsolete it’s actively painful every time it’s brought up.


I’m genuinely curious about PHP because lots of people seem to really like it!

Is it like C++, in the sense that there are still a lot of footguns but people who invest the time to know where they are grow to like the language? Or have they actively removed the bad APIs in recent versions?


PHP made it incredibly easy to build and deploy dynamic websites in an era when those things were not straightforward or widely understood.

The fact that it's a pretty poor language under the hood was irrelevant, because almost anyone could pick it up and intuit how its (crummy) built-in templating worked well enough to get the job done.

Its popularity was largely rooted in how easy it made it to Get Shit Done.

Sure, there were near-apocalypse level footguns everywhere in the first four major versions, but those didn't get noticed until the project had been mostly-working in prod for months.

It got first mover advantage due to that, and that sort of lead dies off very, very slowly.

These days PHP has mostly evolved into Java-lite, with some pretty decent frameworks and tools to keep you far from the footguns lying all around due to backwards compatibility, and CLI tooling to pre-emptively warn you when you've stepped on one (not unlike ESLint or TypeScript, really, which are both projects to make using JS less dangerous).


Ah, so the footguns are still there? Nothing against it (I’m sure a seasoned PHP dev knows to avoid them) but I might pass. I’d be too unsure of myself for a while while I get comfortable with the language.


Some are gone, some are not. In most cases the style checkers and linters will warn you about them pre-emptively.

At least, that was the state of things last I looked. I haven't touched PHP in probably two years now.

Of all the languages I've worked in, it's my least favorite. Well, it's neck and neck with Java.


I remember someone here on HN said most if not all of the problems in this post have since been fixed. Is that actually true?


"Fixed" might be strong, since PHP rightly values backwards compatibility highly, but it is true that most of these issues aren't anything you need to think about when developing in recent PHP versions with recent frameworks.

"Recent" here means roughly "from within the last eight years".

That said, there are many, many ancient PHP codebase out there that depend on all the worst features of ancient versions and are not going to get fixed any time soon.

The fact that things can be done sanely now doesn't really fix the decades where they couldn't.



A few things are better, but the core design decisions were all bad, and they can't really be changed over time. No matter how many surface problems they clean up, you will always be better off using any other language.


Absolutely false and a misinformed statement. Every language has design mistakes (like what does “this” mean in JavaScript?). The only question is - how bad is it? PHP’s pretty average now, but gets more Java-like every release. I could make a very long list of quirks in JavaScript you’ve learned to ignore.

Performance is also no longer a significant issue. Facebook, PornHub, Wikipedia, Etsy, Slack, and more are still happily ticking on PHP codebases.


These conversations have become so predictable it's funny. Someone will now bring up that Facebook wrote its own language called hack. Someone else will mention laravel. Another one will say he stepped using php xx years ago and never looked back so the language is still bad for him etc


I admit that my most recent experience with PHP was from two whole years ago. If they’ve made any improvements since then they didn’t tell me. Still, I stand by my statement that anyone would be better off with almost any other language.


> gets more Java-like every release

…and you consider that a good thing???


Well, when this article was written, it had almost no sense of types and was purely dynamic. You could only do things like:

public $string = “Hello”

Now you can do things like:

public ?string $string = null;

public function appendToString (?string $append) : string {


Sigh I was going to write a defense of PHP, but since it's flagged, I won't bother.


Not this again. 12 years later PHP evolved and is still being used.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: