title: Run multiple exec commands at once (But wait for the last one to finish)
body: <p>I've looked around for this and I can't seem to find anyone who is trying to do exactly what I am.</p>
  
  <p>I have information that is passed in to my function via a _POST request. Based on that data, I run an exec command to run a TCL script a certain number of times (with different parameters, based on the post variable). Right now, I have the exec in a foreach so this takes forever to run (the TCL script takes 15 or so seconds to come back, so if I need to run it 100 times, I have a bit of an issue). Here is my code:</p>
  
  <pre><code>    public function executeAction(){
      //code to parse the _POST variable into an array called devices
  
      foreach($devices as $devID){
          exec("../path/to/script.tcl -parameter1 ".$device['param1']." -parameter2 ".$device['param2'], $execout[$devID]);
      }
      print_r($execout);
  }
  </code></pre>
  
  <p>Obviously this code is just an excerpt with big chunks removed, but hopefully it's enough to demonstrate what I'm trying to do.</p>
  
  <p>I need to run all of the execs at once and I need to wait for them all to complete before returning. I also need the output of all of the scripts stored in the array called $execout.</p>
  
  <p>Any ideas?</p>
  
  <p>Thanks!!!</p>