title: Differences between a while loop and a for loop in PHP?
body: <p>I'm reading an ebook on PHP right now, and the author noted that the difference between a while loop and a for loop is that the for loop will count how many times it runs.</p>
  
  <p>So take this:</p>
  
  <pre><code>&lt;?php
      for ($i = 1; $i &lt; 10; $i = $i + 1) {
          print "Number $i\n";
      }
  ?&gt; 
  </code></pre>
  
  <p>But wouldn't this be the same as </p>
  
  <pre><code>&lt;?php
      $i = 1;
          while ($i &lt; 10) {
              $i = $i + 1;
              print "Number $i\n";
          }
  ?&gt;
  </code></pre>
  
  <p>Or is there some other differences that he didn't point out? (Aside from using while loop for when you're unsure of how long the condition will remain true, such as selecting rows from a database)</p>
  
  <p>I mean, if that's the only difference, can't I just not use the for loop and use the while loop instead?</p>