Why in this piece of code I need call 2 times curl_multi_exec function.
On first loop I'm executing the curl_multi_exec handler to run sub handler. When CURLM_CALL_MULTI_PERFORM is different from $mrc the loop ends.
In second loop, is where we find the results from curl handlers, and the first loop is executed again, Why?
<?php
do {
$mrc = curl_multi_exec($multiHandle, $active);
} while ($mrc == CURLM_CALL_MULTI_PERFORM);
while ($active && $mrc == CURLM_OK) {
if (curl_multi_select($multiHandle, $timeout) != -1) {
do {
$mrc = curl_multi_exec($multiHandle, $active);
} while ($mrc == CURLM_CALL_MULTI_PERFORM);
}
}
?>
The code was extracted from PHP-Doc site