title: PHP: How to fill an array with dates (Y-m-d) as keys
body: <p>I want to fill an array with values. The <strong>keys</strong> of this array should be <strong>readable dates</strong> in the format 'YEAR-MONTH-DAY'. Starting point is '2010-5-25'.
  The process should abort on the current date. Obviously, all dates should be valid dates.</p>
  
  <p>I thought about doing this loop. But it seems that PHP is not able to check the condition of more than one in a 'for' loop. It does not give me any warnings or errors, though.</p>
  
  <pre><code>    for ($d = 25, $m = 5, $y = 2010,
          $this_day = date('j'),
          $this_month = date('n'),
          $this_year = date('Y');
          ($y &lt;= $this_year) &amp;&amp; ($m &lt;= $this_month) &amp;&amp; ($d &lt;= $this_day);
          $d++)
      {
              $values[$y.'-'.$m.'-'.$d] = 0; //fill array
              $d++;
              if(!checkdate($m, $d, $y)){
                  $d = 1;
                  $m++;
                  if($m &gt; 12) { $m = 1; $y++; }
          }
      }
  </code></pre>
  
  <p>Doing this with nested loops would be rather painful.</p>
  
  <p>One solution would be to use integer times as keys and then convert them later in another loop into the readable dates.</p>
  
  <p>Is there a more efficient way?</p>