Haven't been following php in years, but from back in the day I remember many different approaches trying to introduce threads and none could guarantee safety for the fundamental reason that the language itself is implemented unsafely. The runtime was done in C with unsafe features from the start. So process forking was the only sane reason to run php. I don't know how much of that is still true, though.
Re:A look at modern PHP
by kangoo1707 on Tuesday May 05, 2020 @07:12AM
(#23078728)
still, no proper multithreading, in comparison with Java, C#, Elixir...
Define proper please.
Re:A look at modern PHP
by kangoo1707 on Tuesday May 05, 2020 @09:48AM
(#23079963)
No native support for concurrency operators, no real event loop implementation, lack built-in support for non-blocking IO...
I do Elixir regularly and Actor Model is not something PHP developers know
> I do Elixir regularly and Actor Model is not something PHP developers know
/me clutches pearls
What a travesty! I wish, I, a lowly, stupid PHP developer was smart enough to know about the Actor model!
/s
Re:A look at modern PHP
by Eremotherium on Tuesday May 05, 2020 @01:09PM
(#23082280)
Look into ReactPHP, Swoole and Spatie
Is this just a long way of saying it doesn’t have “async” because threads are a perfectly fine concurrency primitive that you can build event loops on top of.
There is async in PHP
Not being a BEAM language is not unique to PHP or it's relevant peer languages.
Maybe you are not familiar with PHP multithreading in recent times but I have been using https://github.com/krakjoe/pthreads and works perfectly. No process forking.