r/PHP • • Dec 29 '24

What is PHP lacking in comparison to Nodejs / Golang / Java?

[deleted] — view deleted post

85 Upvotes

213 comments sorted by

View all comments

Show parent comment

3

u/Miserable_Ad7246 Dec 29 '24

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.

5

u/rsmike Dec 29 '24

Enums got added in 2024 (!)

Enums got added in 2021, Mr. Expert

-3

u/Miserable_Ad7246 Dec 29 '24

Potato potato. In my company only now php devs started using them, it took a bit to update projects.

0

u/[deleted] Dec 29 '24

[deleted] — view deleted comment

2

u/Miserable_Ad7246 Dec 29 '24

This is true, but due to dynamic nature of php that unboxing and working with pure values is more complicated. Like copy on write. 

And yes generics would help a lot, will be interesting to read about internals once its implemented.

1

u/obstreperous_troll Dec 29 '24

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.

1

u/Miserable_Ad7246 Dec 29 '24

This is one of those areas I know little about. Do you have any sources to read about such as unboxings?

When I think about key issues of zvalues for me its all about arrays. You want that in heap and have values raw to leverage cachelines.