title: PHP functions to parse multidimensional array?
body: <p>I run a query and<code>fetchAll()</code>  </p>
  
  <pre><code>$query = "SELECT uid, kill_count FROM users WHERE curmid=:mid AND status='1'";
  ...
  $row = $stmt-&gt;fetchAll();
  </code></pre>
  
  <p>that returns this array:  </p>
  
  <pre><code>Array ( 
   [0] =&gt; Array ( [uid] =&gt; 105 [fcount] =&gt; 1 ) 
   [1] =&gt; Array ( [uid] =&gt; 106 [fcount] =&gt; 2 ) 
   [2] =&gt; Array ( [uid] =&gt; 107 [fcount] =&gt; 0 ) 
   [3] =&gt; Array ( [uid] =&gt; 108 [fcount] =&gt; 1 ) 
   [4] =&gt; Array ( [uid] =&gt; 109 [fcount] =&gt; 1 ) 
  )  
  </code></pre>
  
  <p>I have a loop that I want to run it through that is basically:  </p>
  
  <pre><code>$problist = array();
  foreach ($row as $key =&gt; $value) {
      if ($value == 0) {
          array_push($problist, $key, $key, $key, $key, $key);
      } elseif ($value == 1) {
          array_push($problist, $key, $key, $key);
      } elseif ($value &gt;= 2) {
          $problist[] = $key;
      }
  }
  </code></pre>
  
  <p>Of course, that loop doesn't work as it doesn't reference the proper values in the array.  The output I'm looking for, in this hypothetical, is:  <code>$problist =</code>  </p>
  
  <pre><code>array(15) { 
  [0]=&gt; string(3) "105" 
  [1]=&gt; string(3) "105" 
  [2]=&gt; string(3) "105" 
  [3]=&gt; string(3) "106" 
  [4]=&gt; string(3) "107" 
  [5]=&gt; string(3) "107" 
  [6]=&gt; string(3) "107" 
  [7]=&gt; string(3) "107" 
  [8]=&gt; string(3) "107" 
  [9]=&gt; string(3) "108" 
  [10]=&gt; string(3) "108" 
  [11]=&gt; string(3) "108"
  [12]=&gt; string(3) "109" 
  [13]=&gt; string(3) "109" 
  [14]=&gt; string(3) "109" 
  }  
  </code></pre>
  
  <p>I've read and tinkered and then read and tinkered cannot figure out which php functions to use to make this work.  I've tried <code>end()</code>, <code>reset()</code>, <code>array_shift()</code>, and others.  It is certainly possible that in my ignorance I wasn't using them correctly.  Thanks for the help.</p>
  
  <p>[Perhaps there is even a better way to format my query?]</p>