title: How to run a PHP script asynchronously?
body: <p>I am creating a PHP script that will be run via the command line. As part of this script, there are times where I might need to spawn/fork a different script that could take a long time to complete. I don't want to block the original script from completing. If I were doing this with JavaScript, I could run AJAX requests in the background. That is essentially what I am trying to do here. I don't need to know when the forks complete, just that they start and complete themselves.</p>
  
  <p>How can I run these PHP scripts asynchronously?</p>
  
  <pre><code>foreach ($lotsOfItems as $item) {
      if ($item-&gt;needsExtraHelp) {
          //start some asynchronous process here, and pass it $item
      }
  }
  </code></pre>