title: For Loop Inside Switch Statement in PHP
body: <p>I have certain ranges saved in array with price at index [3] and discount type at index [4] (%, fixed).
  Anyone buying within those ranges should get available discount. 
  My Current Problem is range of an array could be of any count, for example here in variable <code>$a</code>, there is <code>4 nested array</code>, but in certain case, i would be making <code>6 nested array</code>, or <code>8 nested array</code> , so on and so forth. </p>
  
  <p>So, I was running for loop inside my switch statement, and i got an error <code>Parse error: syntax error, unexpected 'for' (T_FOR), expecting case (T_CASE) or default (T_DEFAULT) or '}'</code>.</p>
  
  <p>Here is my code :-</p>
  
  <pre><code>&lt;?php
  
  $a = array(array('0', '10', '200', '0'), array('11', '20', '20', '1'), array('20', '50', '25', '1'), array('50', '100', '5000', '0'));
  
  $quantity = 25;
  
  $count = count($a);
  
  
  switch($quantity) {
      for($i=0;$&lt;=$count-1;$i++) {
          case ($quantity &gt; $a[$i][0] &amp;&amp; $quantity &lt; $a[$i][1]) :
              echo "Discount Available for Quantity &gt; ".$a[$i][0]." and &lt; ".$a[$i][1];
              break;
      }
      default:
          echo 'No Discount';
          break;
  }
  
  ?&gt;
  </code></pre>
  
  <p>How should i design my algorithm for above scenario.</p>
  
  <p><strong>NOTE</strong>: Array Type :-</p>
  
  <p><code>$variable = array ("lowest_quantity_range", "highest_quantity_range", "discount_value", "discount_type");</code></p>
  
  <p>discount type will be either <code>1</code> for <code>%</code> or <code>0</code> for <code>fixed</code> amount</p>