title: phph - How to loop through a multidemsional array
body: <p>I am attempting to return a list of teams along with the players on the team. Here is a shortened version of my array. </p>
  
  <pre><code>Array ( 
      [0] =&gt; Array ( 
          [team_id] =&gt; 1 
          [team_name] =&gt; Team1 
          [players] =&gt; Array ( 
               [0] =&gt; stdClass Object ( 
                   [n_name] =&gt; player1 ) 
               [1] =&gt; stdClass Object ( 
                   [n_name] =&gt; player2 )
       ) ) 
     [1] =&gt; Array ( 
          [team_id] =&gt; 2 
          [team_name] =&gt; Team2 
          [players] =&gt; Array ( 
               [0] =&gt; stdClass Object ( 
                   [n_name] =&gt; player3 ) 
               [1] =&gt; stdClass Object ( 
                   [n_name] =&gt; player4 )
       ) )
  ) 
  </code></pre>
  
  <p>How would I approach looping through the teams and players to get something similar to:</p>
  
  <pre><code>TEAM_ID: 1
  TEAM_NAME: Team1
  PLAYERS: player1, player2
  
  TEAM_ID: 2
  TEAM_NAME: Team2
  PLAYERS: player3, player4
  </code></pre>
  
  <p>A foreach within a foreach?</p>