title: change key names in array in php
body: <p>ok..I'm trying to re-map the keynames of a key-value array in php using a fieldmap array ie.
  i want the <code>$outRow</code> array to hold <code>$inRow['name1'] = 10</code> to <code>$outRow['name_1'] = 10</code> for a large set of pre-mapped values..</p>
  
  <pre><code>        $fieldmap=array("name1"=&gt;"name_1","name2"=&gt;"name_2");
  
            private function mapRow($inRow) {
  
              $outRow = array();
  
              foreach($inRow as $key =&gt; $value) {
  
                  $outRow[$this-&gt;fieldmap[$key]][] = $value;
  
              }
  
              return $outRow;
  
            }  // end mapRow
  
  
    public function getListings($inSql) {
  
      // get data from new table
      $result = mysql_query($inSql);
      if (!result) {
        throw new exception("retsTranslate SQL Error: $inSql");
      }
  
      while ($row = mysql_fetch_assoc($result)) {
  
        $outResult[] = $this-&gt;mapRow($row);
  
      }
  
      return $outResult;
  
    }  // end getListings
  </code></pre>
  
  <p>this is not working..I'm getting the array but its using <code>$outResult[0][keyname]</code>...I hope this is clear enough :)</p>