title: Pthreads PHP : execute Foreach Loop in Parallel
body: <p>How to convert  code from core PHP to Pthread code  </p>
  
  <p><strong>My core PHP code :</strong></p>
  
  <pre><code>require_once 'xyz.php';
  $count="0";
  
  foreach($sites as $site)
  {
  require_once 'allsite/'.$site.'.php';
  $siteObj = new $site;
  $data[$count] = $siteObj-&gt;getsiteData($query,$cat);
  $count++;
  }
  </code></pre>
  
  <p><strong>How can i execute foreach loop code in Pthread manner</strong> ( Multi-threading )</p>
  
  <p><strong>After foreach loop execution complete normal PHP stuff done</strong> (Means No Multi-Threading after foreach Loop) </p>
  
  <p><strong>Note :</strong> I already installed and config  pthread in PHP</p>