title: PHP pthread doesnt seems to be multithreading
body: <p>Please assist if possible. I intended to pull an X amount of rows from a DB, separating them into arrays of 20 arrays and pass them to a thread for processing simultaneously.</p>
  
  <p>To ensure the process was working simultaneously i created a quick thread that echo's out the thread number then counts to 20. I expected to see results like "1 at 1" then "2 at 1". Instead i see the first thread counts to 20 before the second thread begins to execute. ie "1 at 1" ... "1 at 20" then only "2 at 1".</p>
  
  <pre><code>&lt;?php
  class helloworld extends Thread {
      public function __construct($arg){
          $this-&gt;arg = $arg;
      }
      public function run(){
          if($this-&gt;arg){
              for ($i=1;$i&lt;=20;$i++){
                  echo $this-&gt;arg ." AT ";
                  echo $i." ";
                  sleep(1);
              }
          }
      }
  }
  </code></pre>
  
  <p>?></p>
  
  <p>Then to call it i use</p>
  
  <pre><code>for ($i=1;$i&lt;=$num_threads;$i++){
      $thread[$i] = new helloworld($i);
      if($thread[$i]-&gt;start())
          $thread[$i]-&gt;join();
  }
  </code></pre>
  
  <p>Is what i am seeing correct? Or am i doing something stupid here?</p>
  
  <p>Thanks</p>
  
  <p>Rob</p>