title: Accessing PHP array inside for loop
body: <p>Why does the following code return correctly when called explicitly for 1, but not when called in a for loop?</p>
  
  <blockquote>
    <p>name: Granola price: 5.99<br>
    1 name: price:<br>
    2 name: price:</p>
  </blockquote>
  
  <pre><code>&lt;?php
          echo "name: " . $data[1][p_name];
          echo " price: " . $data[1][price] . "&lt;br /&gt;";
  
          for ($i = 1; $i &lt;= count($data); $i++) {
              echo $i . " name: " . $data[i][p_name];
              echo " price: " . $data[i][price] . "&lt;br /&gt;";
          }
  ?&gt;
  </code></pre>