Re: [VOTE] True Async RFC 1.6

From: Date: Sat, 22 Nov 2025 10:37:21 +0000
Subject: Re: [VOTE] True Async RFC 1.6
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16  Groups: php.internals 
Request: Send a blank email to internals+get-129386@lists.php.net to get a copy of this message
Hello > I expect that's already a good improvement for many use cases to read multiple files in > parallel, run multiple queries in parallel, etc. I see. You want to get several promises to wait for? Then there is a good way to do it without additional functions: ```php $promise1 = spawn(file_get_content(...), "file1.txt"); $promise2 = spawn(file_get_content(...), "file2.txt"); $promise3 = spawn(file_get_content(...), "file3.txt"); ``` This is equivalent because a coroutine is a Future. In the same way, you can turn any other function into a Promise without creating a separate API. There is a nuance regarding resources. And in certain scenarios, creating an array of Promises in another way can save memory. For example, a scenario where you need to handle a large array of sockets. Such cases require a special API. --- Ed

« previous php.internals (#129386) next »