title: putting shell_exec() output into array
body: <p>I have a line of php :</p>
  
  <pre><code>$output = shell_exec('ps aux | grep 9902 | awk \'{print $11" "$2}\'');
  </code></pre>
  
  <p><code>print $output;</code> will give the output : </p>
  
  <pre><code>rtmpgw 10089
  /usr/bin/vlc 10107
  sh 10123
  grep 10125
  </code></pre>
  
  <p>I tried using this next line to put the above output into an array.</p>
  
  <pre><code>$oparray = explode(" ", trim($output));
  </code></pre>
  
  <p>It works, but not as expected. <code>print_r($oparray);</code> will give the following output :</p>
  
  <pre><code>Array
  (
      [0] =&gt; rtmpgw
      [1] =&gt; 10089
  /usr/bin/vlc
      [2] =&gt; 10107
  sh
      [3] =&gt; 10123
  grep
      [4] =&gt; 10125
  )
  </code></pre>
  
  <p>This confuses me as I would expect an Index number for each value but three of the values appear to be without indices. </p>
  
  <p>So I suppose my question here is two parts </p>
  
  <ol>
  <li>What is going on in the output above </li>
  <li><p>Can anyone help me get a useful array that looks like this :</p>
  
  <p>Array<br>
  (
      [0] => rtmpgw
      [1] => 10089
      [2] => /usr/bin/vlc
      [3] => 10107
      [4] => sh
      [5] => 10123
      [6] => grep
      [7] => 10125
  )</p></li>
  </ol>
  
  <p>Thanks~</p>