title: Illegal string offset 'key'
body: <p>I have this code:</p>
  
  <pre><code>// Champion name and splash art
  $endpointChampion = file_get_contents("https://global.api.riotgames.com/api/lol/static-data/BR/v1.2/champion/".$championMastery."?api_key=MYKEY");
  $jsonChampion = json_decode($endpointChampion, true);
  
  foreach ($jsonChampion as $champion) {  
      if (isset($jsonChampion['key'])) {
          $championKey = $champion['key'];
      }
  }
  </code></pre>
  
  <p>But this $championKey variable returns "o" and 3 warnings are prompted on screen:</p>
  
  <p><em>Warning: Illegal string offset 'key' in E:\xampp\htdocs\riot\index.php on line 41</em></p>
  
  <p>I also tried to validate the entry, using <code>isset()</code> but seems not work properly.</p>
  
  <p>The $championMastery is retrieved here:</p>
  
  <pre><code>$endpointMastery = file_get_contents("https://br.api.riotgames.com/championmastery/location/BR1/player/8083198/champions?api_key=MYKEY");
  $jsonMastery = json_decode($endpointMastery, true);
  
  foreach ($jsonMastery as $mastery) {
      $championMastery = $mastery['championId'];
      $masteryLevel = $mastery['championLevel'];
  }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/RMaj2.png" alt="screenshot"></p>