title: error when I add break to foreach loop
body: <p>Okay, this is really frustrating me and I don't know why. I have been scouring the internet for at least two days trying to figure out the problem. I am trying to pull xp amount for a certain skill for all the names stored in the database. It echoed the specified xp for all the users in the database, but was repeating the values with an undefined index. Even though that error is there it still prints the values. I researched the internet and found that break will stop the repeating, but when I add the break it then wont print the values and just gives me the undefined index.  THe index does exist. </p>
  
  <pre><code>$sql = "SELECT rsn FROM users";
  
  $qry = $conn-&gt;prepare($sql);
  
  $qry-&gt;execute();
  
  while($row = $qry-&gt;fetch(PDO::FETCH_ASSOC)) {
  
      $rsn = $row['rsn'];
  
      $hs = file_get_contents("http://hiscore.runescape.com/index_lite.ws?player=". $rsn);
  
      $hs = explode("\n",$hs);
  
      $skills = array("Overall","Attack","Defence","Strength","Constitution","Ranged","Prayer","Magic","Cooking","Woodcutting","Fletching","Fishing","Firemaking","Crafting","Smithing","Mining","Herblore","Agility","Thieving","Slayer","Farming","Runecrafting","Hunter","Construction","Summoning","Dungeoneering", "Divination", "Invention");
  
      $i = 0;
  
      foreach(array_unique($skills) as $value){
  
          $hs[$i] = explode(",",$hs[$i]);
  
          $stats[$value]["rank"] = number_format($hs[$i][0]);
  
          $stats[$value]["level"] = number_format($hs[$i][1]);
  
          $stats[$value]["xp"] = number_format($hs[$i][2]);
  
          $i++;
  
          /*require_once 'tourny_config_include.php';
  
          $sql = "UPDATE active_tourny SET xp = :xp AND from_date = :from AND to_date = :to WHERE rsn = :rsn";
  
          $qry = $conn-&gt;prepare($sql);
  
          $qry-&gt;execute(array(':xp' =&gt; $xp, ':rsn' =&gt; $rsn, ':to' =&gt; $tournyTo, ':from' =&gt; $tournyFrom));*/
  
          echo $stats["Attack"]["xp"] . '&lt;br&gt;';
  
          break;
  
      }
  
  }
  </code></pre>