title: getting output and exit status from shell_exec()
body: <p>When doing something like</p>
  
  <pre><code>$output = shell_exec("command 2&gt;&amp;1");
  </code></pre>
  
  <p>collecting the command's stdout &amp; stderr in <code>$output</code>, is there a way to find the command's exit status?</p>
  
  <p>One could write the command output to a temp file and then append the exit status, but that's rather clunky. Any better suggestions?</p>