title: Using a foreach within an object that uses arrays
body: <p>the following is working code:</p>
  
  <pre><code>        $openchart-&gt;type("BarChart");
      $openchart-&gt;options(array('title' =&gt; "Opens Stats"));
      $openchart-&gt;columns(array(
          'Date' =&gt; array(
              'type' =&gt; 'string',
              'label' =&gt; 'Date'
          ),
          'yahoo.com' =&gt; array(
              'type' =&gt; 'number',
              'label' =&gt; 'yahoo.com'
          )
      ));
  
      $openchart-&gt;addRow(array('Date' =&gt; "Today", 'yahoo.com'=&gt; $chart['yahoo.com']['opentoday']));
  </code></pre>
  
  <p>what I want to be able to do is like the following, but not sure how to accomplish.</p>
  
  <pre><code>        $openchart-&gt;type("BarChart");
      $openchart-&gt;options(array('title' =&gt; "Opens Stats"));
      $openchart-&gt;columns(array(
          'Date' =&gt; array(
              'type' =&gt; 'string',
              'label' =&gt; 'Date'
          ),
  foreach($chart[$name])
          '$name' =&gt; array(
              'type' =&gt; 'number',
              'label' =&gt; '$name'
          )
      ));
  
      $openchart-&gt;addRow(array('Date' =&gt; "Today", '$name'=&gt; $chart['$name']['opentoday']));
  </code></pre>
  
  <p>is this possible?  still very new to PHP.  am also using CakePHP (and learning a TON by just trial and error!)</p>
  
  <p>Originally I just tried</p>
  
  <pre><code>$openchart-&gt;columnts( array(           
              '$name' =&gt; array(
              'type' =&gt; 'number',
              'label' =&gt; '$name'
          ));
  </code></pre>
  
  <p>but that overwrote the array.  also checked out array_merge, but that wasn't working, and not sure why.</p>
  
  <p>so now at the end of my first foreach (not shown), I have an array of all the values I want, in $chart[$name]</p>
  
  <p>and figured that might be best route to then do the 'columns' all at once.</p>
  
  <p>love that this site exists, getting so much accomplished.  thank you!</p>