title: PHP Nested for loop - pyramid shape
body: <p>Using a nested for loop in PHP, i have to create the following pattern:</p>
  
  <pre><code>- - - - - - - - - - - - - - -
  - - - - - - - + - - - - - - -
  - - - - - - + + + - - - - - -
  - - - - - + + + + + - - - - -
  - - - - + + + + + + + - - - -
  - - - + + + + + + + + + - - -
  - - + + + + + + + + + + + - -
  - + + + + + + + + + + + + + -
  + + + + + + + + + + + + + + +
  </code></pre>
  
  <p>I have tried to do this and wrote the following code:</p>
  
  <pre><code>$pluscount = -1;
  $mincount  = 8;
  for ($rows = 0; $rows &lt;= 8; $rows++) {
      for ($min = 0; $min &lt; $mincount; $min++) {
          echo " - ";
      }
      for ($plus = 0; $plus &lt; $pluscount; $plus++) {
          echo " + ";
      }
      for ($min = 0; $min &lt; $mincount; $min++) {
          echo " - ";
      }
      $pluscount += 2;
      $mincount  = (15 - $pluscount) / 2;
      echo "&lt;br /&gt;";
  }
  </code></pre>
  
  <p>However, this results in:</p>
  
  <pre><code>- - - - - - - - - - - - - - - - 
  - - - - - - - + - - - - - - - 
  - - - - - - + + + - - - - - - 
  - - - - - + + + + + - - - - - 
  - - - - + + + + + + + - - - - 
  - - - + + + + + + + + + - - - 
  - - + + + + + + + + + + + - - 
  - + + + + + + + + + + + + + - 
  + + + + + + + + + + + + + + + 
  </code></pre>
  
  <p>As you can see, the first line is incorrect. How do I solve this?</p>