Live data from Hacker News

PHP in 2022

stitcher.io

191–200 of 318 posts

Re: PHP in 2022

#191
post #12

It's still a language that's mainly used for web development, right? Modern websites in big companies require pretty complex backends that require data processing queues and other background activities. Can PHP compete with languages such as Go, Python or Ruby in the future?

To provide an actual data point: I successfully built one of the largest messaging APIs using PHP. We had a horizontally (and dynamically) scalable architecture, ran hundreds of worker nodes in Kubernetes, that processed thousands of messages per second. The nice things about PHP were:

* Interoperability with the rest of our ecosystem, including the web platform: We could share code and install modules in all projects

* Availability of packages: For lots of common use cases, there are high-quality libraries available, such as process forking, socket communication, or message queues

* Easy to go from PoC to production: Start out with no-brainer arrays, then move to typed data structures easily

I find all the syntax critique on PHP to be completely irrelevant. It's a high-performance, dynamically typed scripting language. I can build the same things in it as with Go, Python or TypeScript, but the ecosystem is stable, tweaking it for production is easy, and it goes from "shoddy hackathon script" to "fully typed, production-grade application" smoothly. There's a single, pretty great package manager; type checking, although limited, works at runtime; code doesn't need to be compiled prior to running. All this makes it a good choice even for big projects to me.

Re: PHP in 2022

#192
post #47

Earlier quoted context omitted.

> Javascript is what PHP should be since day 1. ReasonML or ReScript is what JS should have been since day 1.

It's not fun sir. What's the point of those $$$ mark for variables ? Make no sense at all. Easy adoption for all levels of programmers is what make it work for enterprise applications now.

For one thing, it makes the distinction between language keywords and variables clear - no problems in using `$switch` or `$var`, and even more important, the core devs don't have to take as much care when developing new language features. Not that I usually use variable names like these, but it quickly becomes automatic to use a dollar sign.

Re: PHP in 2022

#193

Earlier quoted context omitted.

> If you are enough aware of the differences that you know you should use `===` Every beginner knows that because all recent books literally say "don't use ==, use ===", modern IDEs will point it out for you and 1st code review feedback will point it out. What usage of this moot point showcases for me is mostly author's blind bashing without real knowledge.

If you only know "don't use ==, use ===", you will just fall for the next unityped trap. If you know why you shouldn't use `==`, you know enough so that even if you don't go for `===`, using `==` safely is the least of your problems.

> for the next unityped trap

Many languages are unityped and carry the same problems, yet they are hyped rather than bashed (e.g. Python, Ruby).

> If you know why you shouldn't use `==`, you know enough so that even if you don't go for `===`, using `==` safely is the least of your problems.

You have some weird false dichotomy going on. I'm personally in the state "I remember why == is bad (type coercion ...)" but I don't remember all the details to be able to use == correctly. I bet many people are in a similar situation.

Re: PHP in 2022

#194
post #188
post #74

I learned to use php when I was like 14. I’m 27 now and still derive such joy when making my own little projects that will never see the light of day. I try to be humble as far as just being a php trash coder, but I don’t feel too ashamed honestly, as it is the most mainstream thing really. I will always be grateful to php for being accessible and yeah, I guess easy. I don’t know why php is the only one I really stuc…

I'm one of those web devs that tries everything under the sun, and I also happen to have worked for a lot of companies (more than a dozen already, I'm on my 40s). Laravel is such a *joy*. I've never had this feeling of using something so easy and productive. I've been recently building a side project with LiveWire and oh-my-god. I really wish I had discovered it before. From the templating system (you get components…

Did also plaid with Ruby on Rails, or even Sinatra, and how would your rank the dev XP compared to Laravel?

Re: PHP in 2022

#195
post #47

Earlier quoted context omitted.

> Javascript is what PHP should be since day 1. ReasonML or ReScript is what JS should have been since day 1.

Scheme is what JS should have been since day 1.

Guile in the browser would make plenty of sense had someone not shoved the mess that was early JS into the world.

Re: PHP in 2022

#196
post #188
post #74

I learned to use php when I was like 14. I’m 27 now and still derive such joy when making my own little projects that will never see the light of day. I try to be humble as far as just being a php trash coder, but I don’t feel too ashamed honestly, as it is the most mainstream thing really. I will always be grateful to php for being accessible and yeah, I guess easy. I don’t know why php is the only one I really stuc…

I'm one of those web devs that tries everything under the sun, and I also happen to have worked for a lot of companies (more than a dozen already, I'm on my 40s). Laravel is such a *joy*. I've never had this feeling of using something so easy and productive. I've been recently building a side project with LiveWire and oh-my-god. I really wish I had discovered it before. From the templating system (you get components…

Laravel and Livewire is the best-kept secret ever because everybody is too busy being biased against PHP.

Re: PHP in 2022

#197

Earlier quoted context omitted.

I feel it's the opposite. Always a lot of people defending PHP in these threads, no criticism allowed. Gives a very misleading picture of the industry - in reality, PHP is not a loved language, it's below Powershell and just over C in the latest ranking[0] with 40% love / 60% dread. [0]: https://insights.stackoverflow.com/survey/2021#technology-mo...

This only adds fuel to my argument. Yeah let's post a results on how people FEEL about a language. How is that objective? I could argue 100% of the 40% of the people actually uses PHP and 100% of the 60% people don't even use it.

I've worked in PHP for years. It still makes me nauseous. I would never recommend anybody to learn PHP, it's simply a shitty language all around.

Re: PHP in 2022

#198

Earlier quoted context omitted.

In a world where everything is fast becoming a JavaScript front end with “some” backend and with the improvements PHP has seen in recent years I don’t see why you’d consider yourself a “lowly” php developer. I’m mainly a C# guy myself as far as the backend goes, but I don’t view PHP as being bad in 2022. I think people who do are stuck in the past to be perfectly honest. It’s sort of like disliking JavaScript because…

I think unambiguously janky design choices like this[1] in PHP's early history is what's given it such a bad reputation, while it might be a decent language now such a reputation is hard to shake. I'll be honest the only time I'd reach for PHP over a comparable language with a less chequered history like Python is if I was dealing with a project that was already closely tied up in the PHP ecosystem. [1] https://www.i…

Unfortunately the bad design choices from the past are mostly here to stay - I mean, when you have the thing you want to find (the "needle") as the first parameter in about half of your "find something in something else"-type functions and the "haystack" as the first parameter in the other half, are you really going to break backward compatibility just to make things consistent? Of course not! So PHP will never be my favourite language (although I work with it every day), but it gets the job done, so...

Since you mentioned Python: I would never think of using Python instead of PHP, at least not for a web-based project. Performance-wise PHP is (I think) better thanks to all the work Facebook sponsored, and it has all the "batteries" needed for web development included, so the only reason for choosing Python would be that it's maybe more "elegant".

Re: PHP in 2022

#199
post #9

Is it just me or PHP's evolution is a bit "too little, too late" for an almost 30-years old language? PHP is not a likable language but it's probably not going away any time soon. Its concept of "one endpoint is one script" is one of its biggest killer features that no other language has been able to deploy in such an accessible manner. Well, Perl and old-style CGI aside, of course. That, and also the fact that it ma…

> That, and also the fact that it may be pretty much the only dynamic language in use today with ARC and not a GC.

Python and Perl use reference counting too. Ruby, Lua and JS (at least v8) are GC'd. PHP isn't unique in that regard.

Re: PHP in 2022

#200

Earlier quoted context omitted.

> A language that uses archaic syntax with dollar vars, semicolons, is pretty verbose itself may die Careful there :-) Modern javascript has semicolons and is introducing pretty horrendous syntax for private variables (an octothorpe) and possibly for the pipe operator (percent sign, was it?) and for tuples and records, yet is showing no signs of dying.

I have never written JS with semicolons after 2015 idk why you are saying Modern JS has semicolons? I simply didn't get it. Am I missing something.

I mean, it clearly has them; it's part of the syntax. You can skip them, and the parser will insert them for you; but the language has them.
Post reply on HN