title: Add Array Column to Multidimensional Array Using array_merge in foreach Loop
body: <p>I'm trying to add another column of data to each row in a foreach loop. It's purpose is to remember the element of data importeded from XML processed to an multidimensional array.  It's stuck as a scalar though the var_dumps looks fine.</p>
  
  <pre><code>&lt;?php 
  $KEY = 0;
  foreach ($eventsArray as $keyMe){
    $thisKey['KEY'][0] = strval($KEY);
    $keyedArray = array_merge($keyMe, $thisKey);
  $KEY++;
  }
  
  // Prep for multisort
  foreach ($keyedArray as $key =&gt; $value){
    $date[$key] = $value['DATE'];
    $title[$key] = $value['TITLE'];
    $link[$key] = $value['LINK'];
    $slide[$key] = $value['SLIDE'];
    $location[$key] = $value['LOCATION'];
    $time[$key]= $value['TIME'];
    $KEY[$key] = $value['KEY']; // Warning: Cannot use a scalar value as an array
  }
  
  /* var_dump(
  array(7) { 
    ["DATE"]=&gt; array(1) { [0]=&gt; string(10) "2012-12-18" } 
    ["TITLE"]=&gt; array(1) { [0]=&gt; string(20) "Event Title" } 
    ["LINK"]=&gt; array(1) { [0]=&gt; string(38) "aLinkLocation.htm" } 
    ["SLIDE"]=&gt; array(1) { [0]=&gt; string(2) "16" } 
    ["LOCATION"]=&gt; array(1) { [0]=&gt; string(8) "Location of Event" } 
    ["TIME"]=&gt; array(1) { [0]=&gt; string(3) "8am" } 
    ["KEY"]=&gt; array(1) { [0]=&gt; string(2) "23" } 
  } 
  */
  </code></pre>