title: Get key values from multidimensional array
body: <p>I have a page that searches a database and generates the following array. I'd like to be able to loop through the array and pick out the value next assigned to the key "contact_id" and do something with it, but I have no idea how to get down to that level of the array.</p>
  
  <p>The array is dynamically generated, so depending on what I search for the index numbers under "values" will change accordingly.</p>
  
  <p>I'm thinking I have to do a foreach starting under values, but I don't know how to start a foreach at a sublevel of an array.</p>
  
  <pre><code>Array ( 
  [is_error] =&gt; 0 
  [version] =&gt; 3 
  [count] =&gt; 2 
  [values] =&gt; Array ( 
      [556053] =&gt; Array ( 
          [contact_id] =&gt; 556053 
          [contact_type] =&gt; Individual 
          [first_name] =&gt; Brian 
          [last_name] =&gt; YYY 
          [contact_is_deleted] =&gt; 0 
      ) 
      [596945] =&gt; Array ( 
          [contact_id] =&gt; 596945 
          [contact_type] =&gt; Individual 
          [first_name] =&gt; Brian 
          [last_name] =&gt; XXX 
          [contact_is_deleted] =&gt; 0 
      ) 
  ) 
  </code></pre>
  
  <p>)</p>
  
  <p>I've looked at the following post, but it seems to only address the situation where the array indices are sequential.
  <a href="https://stackoverflow.com/questions/6320681/multidimensional-array-how-to-get-specific-values-from-sub-array">Multidimensional array - how to get specific values from sub-array</a></p>
  
  <p>Any ideas?</p>
  
  <p>Brian</p>