Hacker News new | ask | show | jobs
by JimDabell 779 days ago
I’ve been hearing “Yes, PHP used to suck but it’s good now!” after every major release since v4. And even after minor releases during v5!

Yes, PHP 3 sucked, but PHP 4 is good now!

Yes, PHP 4 sucked, but PHP 5 is good now!

Yes, PHP 5.0 sucked, but PHP 5.3 is good now!

Yes, PHP 5.3 sucked, but PHP 5.5 is good now!

Let’s not talk about PHP 6!

Yes, PHP 5 sucked, but PHP 7 is good now!

Every so often I have to deal with some PHP code, and every time I see that, no, it’s still just the boy who cried wolf. It seems like PHP fans are all too happy to agree with the people saying PHP sucks… as long as it’s not the latest version. And suddenly they can see that version’s faults… as soon as a new version is released that they can tell people doesn’t suck. Maybe if PHP fans hadn’t spent the last two decades telling people PHP didn’t suck when it most obviously did, people would be more inclined to listen today.

3 comments

People focus too much on syntax. I have worked with PHP professionally and I have to grant those folks that they got genuinely good libraries and frameworks. But coming from Java, I always found that you are ultimately boxed into a corner.

It surface seems productive and shiny and for 90% of use-cases you get the job done quickly. But for those other 10% you realize that at its center lies a rotten heart, wired together with duct tape. Syntax is not the problem. Horrendous stdlib and IO interop is what keeps it a mess.

Once you try to do anything more sophisticated you realize its many sharp angles which don't make sense. Such as call-by-reference only working 2 recursions deep. Silently failing when opening files which are too large. Arbitrary decisions and namings on stdlib. The hassle of debugging your program.

Or an ongoing struggle in my old company: Wanting to set up old PHP projects and realizing that your package manager doesn't have them anymore.

PHP is a ticking time bomb.

Debugging is pretty easy with something like Ray (https://myray.app/) or Laravel Herd (https://herd.laravel.com/, despite its name runs differnet php apps just fine).

When it coems to running different PHP versions, modern PHP development has largely moved to using Docker (ddev, for example: https://ddev.com/) for that, and there's plenty Docker images for old PHP versions so it's a non-issue. I'd also imagine it be difficult to get many other outdated programming languages via a package manager.

There's now the PHP Foundation, which while relatively new in its formation, has significantly boosted PHP development and I'd recommend donating if improving the language is important to you.

> I'd also imagine it be difficult to get many other outdated programming languages via a package manager.

Java & Maven is extremely stable. It is the exception rather than the rule that something doesn’t build anymore.

Makes sense to use docker. I hope my old company is going with the time by now as well. The problem has always been supporting and updating old applications which you are still contractually obligated in supporting. Bringing them up to speed has always been a struggle. Both, programatically and economically.

> I'd recommend donating if improving the language is important to you.

It's not (-:

> Such as call-by-reference only working 2 recursions deep.

Which smells like an anti-pattern to me. Blaming bad code on the language is one way to deal with it.

> Arbitrary decisions and namings on stdlib.

This is absolutely true and even more annoying I find that the ordering of stdlib arguments is inconsistent. Backwards-compatibility is one of the reasons this has not changed, I guess.

What I don't understand is, why people don't apply that same legitimate criticism to python. I recently had to do a project in python and was astounded by the amount of arbitrary namings and design choices.

I also agree that many php codebases, especially if not written in a good framework, are a hot mess.

That being said, the ecosystem if using decent frameworks with php 8+ versions very productive in terms of time vs results and a joy to work with.

> What I don't understand is, why people don't apply that same legitimate criticism to python. I recently had to do a project in python and was astounded by the amount of arbitrary namings and design choices.

I absolutely do. I appreciate the PHP community for having expertise in actually creating sane tools attempting to do a good job. But Python is just batshit crazy with some of the most wild bugs I have seen and no guardrails whatsoever.

Out of all the languages which got a type-system after the fact, PHP is the best one hands down. Runtime-validation of types + non-null by default keeps some of the bad stuff inside Pandora's box.

> Which smells like an anti-pattern to me. Blaming bad code on the language is one way to deal with it.

It was a simple recursive algorithm which we used to make some custom-highlighting on a few select words (much easier to understand than an equivalent iterative approach). But I wasted a good day until I saw that there was a technological limitation which made the algorithm fall apart, and not the logic itself. That's a quite offputting smell.

Of course I understand the economic choice behind PHP... finding PHP programmers is cheaper than going C# or Java. But having a good background in parallelism and having a good grasp on efficient CPU/JVM usage PHP doesn't provide anything unique. Everything it provides, I can achieve equally fast in other established languages, while posing an actual problem when technological limits are reached.

What I find most important recently is at least getting to do something, being busy sort of. After all, definitively, there will not be a language which satisfies everyone. So, your negativity might be the source of motivation keeping you up to do something involving... php. At least be busy developing, complaining not a good sport.
Then the whole "everything is output unless in the php tag" seems to be never used anymore. I can't see why anyone would choose to start a new project in it.