title: getting information out of an array with key/value pairs
body: <p>I have the following snippet of code that is creating the following array...</p>
  
  <pre><code>while ($stmt-&gt;fetch()) {
    foreach($row as $key =&gt; $val) {
      $x[$key] = $val;
    }
    $results[] = $x;
  }
  </code></pre>
  
  <p>Results in the follow array:</p>
  
  <pre><code>Array ( [0] =&gt; Array ( [cap_login] =&gt; master [cap_pword] =&gt; B-a411dc195b1f04e638565e5479b1880956011badb73361ca ) ) 
  </code></pre>
  
  <p>Basically I want to extract the cap_login and cap_pword values for testing. For some reason I can't get it!
  I've tried this kind of thing:</p>
  
  <pre><code>echo $results[$cap_login]; 
  </code></pre>
  
  <p>but I get the error</p>
  
  <pre><code>Undefined variable: cap_login
  </code></pre>
  
  <p>Can someone put me right here?
  Thanks.</p>