title: PHP Generate Array() from loop?
body: <p>I just wrote this up, is this the most efficient way to add arrays to a preexisting array.</p>
  
  <pre><code>
  $c=4;
  $i=1;
  $myarray = array();
  
  while($i &lt;= $c):
      array_push($myarray, array('key' =&gt; 'value'));
      $i++;
  endwhile;
  
  echo '&lt;pre&gt;&lt;code&gt;';
  var_dump($myarray);
  echo '&lt;/code&gt;&lt;/pre&gt;';
  </code></pre>
  
  <p><strong>Update:</strong> How would you push the key &amp; value, without creating a new array.<br/>
  so this <code>array_push($myarray,'key' =&gt; 'value');</code><br/>
  not this <code>array_push($myarray, array('key' =&gt; 'value'));</code></p>