title: PHP trying to store numbers in for loop into array
body: <p>Let's say I have this code:</p>
  
  <pre><code>&lt;?php
  
  $aLevel[] = 98;
  
  function experience($L) {
   $a=0;
    for($x=1; $x&lt;$L; $x++) {
      $a += floor($x+300*pow(2, ($x/7)));
      $aLevel[$x-1] = $a; // we minus one to comply with array
    }
   return floor($a/4);
  }
  
  for($L=1;$L&lt;100;$L++) {
   echo 'Level '.$L.': '. number_format(experience($L)). '&lt;br /&gt;';
  }
  
  echo $aLevel[0]; // Level 1 should output 0 exp
  echo "&lt;br /&gt;" . $aLevel[1]; // Level 2 should output 83 exp
  // et cetera
  ?&gt;
  </code></pre>
  
  <p>I am trying to make an array to store the exp. So level 1 would be <code>$aLevel[0]</code> and the EXP would be 0 (obviously) and level 2 would be <code>$aLevel[1]</code> and EXP would be 83 and so on.</p>
  
  <p>The code below... it works. The experience and level loop works but the array doesn't.</p>
  
  <p>What am I doing wrong?</p>