title: Drupal - get value from array
body: <p>Maybe it's me but I can't get the values from the following array:</p>
  
  <p><a href="http://picpaste.com/pics/Untitled-2YV5V2Im.1427134235.png" rel="nofollow">http://picpaste.com/pics/Untitled-2YV5V2Im.1427134235.png</a></p>
  
  <p>What I want is to create a table where the headers are like this:</p>
  
  <p>HomeTeam name | AwayTeam name | Match home_goals | Match away_goals</p>
  
  <p>and then I have 9 rows with values.</p>
  
  <p>My code so far:</p>
  
  <pre><code>$json = json_decode($server_output, true);
  $days= $json['Calendar']['championship']['StageRound'][0]['matches'];
  
  $header = ['HomeTeam name', 'AwayTeam name', 'Match home_goals', 'Match away_goals'];
  $row = array();
  
  foreach ($days as $key =&gt; $value) {
    ... here, I get always an error saying 'HomeTeam' is not an index...
  }
  
  $table = theme('table', array('header' =&gt; $header, 'rows' =&gt; $rows));
  
  return $table;
  </code></pre>
  
  <p>Any help?
  Thanks!</p>
  
  <p>EDIT:</p>
  
  <p>Added this code:</p>
  
  <pre><code>foreach ($days as $key =&gt; $value) {
    $hometeam = $days[0]['HomeTeam']['name'];
    $awayteam= $days[0]['AwayTeam']['name'];
    dpm($hometeam . ' - ' . $awayteam);
  }
  </code></pre>
  
  <p>I have the index [0] in both lines inside the for cycle but I need it to be from 0 to 9 (the lenght of the array. That would solve my problem.</p>