title: Run asynchronous while functions or multithread
body: <p>I have a function that makes requests synchronized.
  However, I need to loop for this function to be executed multiple times simultaneously.
  What is the best way in PHP 7.2?</p>
  
  <p>My code is not working as expected:</p>
  
  <pre><code>class AsyncOperation extends Thread
  {
      public function __construct($threadId)
      {
          $this-&gt;threadId = $threadId;
      }
      public function run()
      {
          runMyFunction();
      }
  }
  $start = microtime(true);
  for ($i = 1; $i &lt;= 100; $i++) {
      $t[$i] = new AsyncOperation($i);
      $t[$i]-&gt;start();
  }
  </code></pre>