upvote
Spawning threads in PHP is a mistake. The beauty of PHP is that a given request is single-threaded. Any IO/network bound calls allow off-thread code within that same async-await model. If you want to spawn threads, put it in an extension.
reply
Amen.
reply
Async is about IO, you can already do that in PHP with generators.

Instead of let x = await func(); it's $x = yield from func();

Also ZTS is more about running in threaded servers like Apache worker or IIS, it's not about user threads.

reply
Yes you need to combine it with Fiber's API but it works, but cumbersome, especially integrating with existing libraries and things that are for the shared nothing world.

Most code in PHP would easily run in a thread, but working in Fibers requiring a complete rewrite.

reply
That's certainly a use case but I worry async opens the door for all the non PHP to come on in
reply