What makes it worse is that even ignoring everything you mentioned, PHP is also less ergonomic and requires typing much more code than modern alternatives like Scala, Kotlin, TypeScript or even Java.
People think a proper static type system makes it harder to code, when it's really the opposite. And yeah there is a reason why FB had to create their own entire new language called Hack, with static types among other things to cope with the absolute tech debt they incurred on themselves.
Well to PHPs credit they are moving forward. Enums got added in 2024 (!), where are serious talks about generics, lambda functions are less cumbersome. Give it 5 years and it will be fine. But even after that some core issues will remain, like ZValues. No matter how you dance this will always going to handicap PHP for more serious bespoke scenarios.
Also if you think about say Java or C# or Go, you can write everything in your company using that one language (except web UI, because javascript), with PHP you will eventually be forced to adopt another language for ETLs or to do something PHP was never meant to do.
Long running async php stuff remidies that issue some that. But it creates another one. Namely drivers. Somone who writes some driver related to IO is kind of forced to assume non long running environment. So you run into issues, with having async, but not having drivers.
99% people here will start talking about - but mariadb works and what not. Where are plenty of other dbs which just do not have good drivers for PHP, in some cases do not have official drivers at all, because they assume that PHP will not fit the scenario anyways.
Those type of issues can not be solved by PHP foundation alone, whole community has to switch their ways, and PHP community (not everyone, but most in my experience) is known to be stubborn and ignorant repeating same mantras again and again. Once people here realizes that php-fpm must die for php to advance it will have a really good chance to be more than wordpress or a best way to make e-shops.
Most useful unboxed values (save perhaps packed arrays) are likely going to be allocated on the stack, so no refcounts needed and no COW happening. Some objects could potentially live on the stack too, but practically speaking PHP would probably need a new Record type with value semantics to achieve it. That's a topic that comes up every now and then but it's never gotten to the RFC stage afaik.
View all comments
Show parent comment
5
u/Holonist Dec 29 '24
What makes it worse is that even ignoring everything you mentioned, PHP is also less ergonomic and requires typing much more code than modern alternatives like Scala, Kotlin, TypeScript or even Java.
People think a proper static type system makes it harder to code, when it's really the opposite.
And yeah there is a reason why FB had to create their own entire new language called Hack, with static types among other things to cope with the absolute tech debt they incurred on themselves.