title: Extract value from multidimensional array and place in comma separated string
body: <p>I have an array that looks like this</p>
  
  <pre><code>Array
  (
      [1] =&gt; Array
          (
              [name] =&gt; Zeze
              [city] =&gt; Denver, 
              [state] =&gt; Colorado, 
              [country] =&gt; United States
              [user_id] =&gt; 1
              [cars] =&gt; Array
                  (
                      [140] =&gt; Array
                          (
                              [cars_name] =&gt; BMW
                          )
  
                      [162] =&gt; Array
                          (
                              [cars_name] =&gt; Mazda
                          )
                  )
          )
  
      [8] =&gt; Array
          (
              [name] =&gt; Lex
              [city] =&gt; Schwelm, 
              [state] =&gt; North Rhine-Westphalia, 
              [country] =&gt; Germany
              [user_id] =&gt; 5
              [cars] =&gt; Array
                  (
                      [140] =&gt; Array
                          (
                              [cars_name] =&gt; Mercedes
                          )
  
                      [162] =&gt; Array
                          (
                              [cars_name] =&gt; Audi
                          )
                  )
          )
  )
  </code></pre>
  
  <p>I need to extract the value from <code>user_id</code> and put it in a comma separated string.</p>
  
  <p>For the above array, I would like to get:</p>
  
  <p><code>1,5</code></p>
  
  <p>I'm a bit confused how to loop this array with <code>foreach</code> and then how would I create the string? Or is there a better way?</p>