title: How to access values of a multidimensional associative array
body: <p>I have an array called <code>$scores</code> which has an index called 'team' which itself is an array with indices 'w', 'l' and 'd'. How do I access the values of 'w', 'l' and 'd'?</p>
  
  <p>I have tried:</p>
  
  <pre><code>echo '&lt;td&gt;' . $scores['team']['w'] . '&lt;/td&gt;';
  echo '&lt;td&gt;' . $scores['team']['l'] . '&lt;/td&gt;';
  echo '&lt;td&gt;' . $scores['team']['d'] . '&lt;/td&gt;';
  </code></pre>
  
  <p>and</p>
  
  <pre><code>echo '&lt;td&gt;' . array_values(array_keys($scores['team'], 'w')) . '&lt;/td&gt;';
  echo '&lt;td&gt;' . array_values(array_keys($scores['team'], 'l')) . '&lt;/td&gt;';
  echo '&lt;td&gt;' . array_values(array_keys($scores['team'], 'd')) . '&lt;/td&gt;';
  </code></pre>
  
  <p>But these do not work.</p>
  
  <p>declaring the array:</p>
  
  <pre><code>$scores = array (
                              'team' =&gt; array (
                                                  'w'     =&gt; 0
                                              ,   'l'     =&gt; 0
                                              ,   'd'     =&gt; 0
                                              )
                      );
  </code></pre>
  
  <p>print_r($scores):</p>
  
  <pre><code>Array ( [team] =&gt; Array ( [w] =&gt; 0 [l] =&gt; 0 [d] =&gt; 0 ) [team one] =&gt; Array ( [l] =&gt; 2 [w] =&gt; 1 [d] =&gt; 1 ) [team two] =&gt; Array ( [w] =&gt; 1 [l] =&gt; 1 [d] =&gt; 1 ) [team three] =&gt; Array ( [l] =&gt; 1 ) [team four] =&gt; Array ( [w] =&gt; 1 ) [team five] =&gt; Array ( [w] =&gt; 1 ) )
  </code></pre>