You can \"change\" the key of an array element simply by setting the new key and removing the old:
$array[$newKey] = $array[$oldKey]; unset($array[$oldKey]);
You could use array_combine. It merges an array for keys and another for values...
For instance:
$original_array =('foo'=>'bar','asdf'=>'fdsa'); $new_keys = array('abc', 'def'); $new_array = array_combine($new_keys, $original_array);