title: understanding php curl_multi_exec
body: <p>I'm trying to understand curl_multi_exec. I've copied a piece of the manual example here. So I'm wondering, how does it work? The first loop sends the http request I guess? But it then it is followed by a loop inside a loop using functions with seemingly undocumented flags..</p>
  
  <p>I would like to download +=70 urls +=in parallel. </p>
  
  <p><a href="http://www.php.net/manual/en/function.curl-multi-exec.php">http://www.php.net/manual/en/function.curl-multi-exec.php</a></p>
  
  <pre><code>&lt;?php
  ...
  $active = null;
  //execute the handles
  do {
      $mrc = curl_multi_exec($mh, $active);
  } while ($mrc == CURLM_CALL_MULTI_PERFORM);
  
  while ($active &amp;&amp; $mrc == CURLM_OK) {
      if (curl_multi_select($mh) != -1) {
          do {
              $mrc = curl_multi_exec($mh, $active);
          } while ($mrc == CURLM_CALL_MULTI_PERFORM);
      }
  }
  ...
  ?&gt;
  </code></pre>