curl - How can you keep doing a fixed number of parallel requests using PHP?

one text

I have a long list of URLs which generate files. I want to download them in parallel using PHP with cURL. But not all of them at once but, say, just 10 at once. Not to slow down the server.

(I could of course start 10 downloads at once using curl_multi_exec, then wait till they are all finished, then start the next 10, and so on. But if of the current 10 downloads, say, 9 have already finished, everything has to wait for the slow last one. Then I'm only downloading 1 file in parallel till the next 10 start. So this would only work if all downloads take about the same time, which is not the case for me.)

Source