title: Iterate over months/years; min and max values
body: <p>I have two dates in an array format {YYYY, MM}:</p>
  
  <pre><code>$min = {2014,7};
  $max = {2015,4};
  </code></pre>
  
  <p>I'm trying to iterate through these, starting from the min values and working my way up to the max values. For example, I want to print the below:</p>
  
  <pre><code>7 in 2014
  8 in 2014
  9 in 2014
  ...
  12 in 2014
  1 in 2015
  ...
  4 in 2015
  </code></pre>
  
  <p>Some code as below:</p>
  
  <pre><code>for ($i = $min["0"]; $i &lt;= $max["0"]; $i++) { //year loop
      for ($j = max(1,$min["1"]); $j &lt;= min(12,$max["1"]); $j++) { //month loop
          echo $j." in ".$i."&lt;/br&gt;";
      }
      $min["1"] = 1;
  } 
  </code></pre>
  
  <p>I'm not too sure what to put in the nested for loop. This is as far as I've got, it doesn't quite work.</p>