title: How to increment a number by 2 in a PHP For Loop
body: <p>The following is a simplified version of my code:</p>
  
  <pre><code>&lt;?php for($n=1; $n&lt;=8; $n++): ?&gt;
      &lt;p&gt;&lt;?php echo $n; ?&gt;&lt;/p&gt;
      &lt;p&gt;&lt;?php echo $n; ?&gt;&lt;/p&gt;
  &lt;?php endfor; ?&gt;
  </code></pre>
  
  <p>I want the loop to run 8 times and I want the number in the first paragraph to increment by 1 with each loop, e.g.</p>
  
  <p><code>1, 2, 3, 4, 5, 6, 7, 8</code> (this is obviously simple)</p>
  
  <p>However, I want the number in the second paragraph to increment by 2 with each loop, e.g...</p>
  
  <p><code>1, 3, 5, 7, 9, 11, 13, 15</code></p>
  
  <p>I can't figure out how to make the number in the second paragraph increment by 2 with each loop. If I change it to $n++ then it increments by 2, but it then makes the loop run only 4 times instead of 8.</p>
  
  <p>Any help would be much appreciated. Thanks!</p>