If you want to change the key of an item, you must either set the value with the new key and unset()
the old one (this technique changes the order of the array):
$arr['newName'] = $arr[0];
unset($arr[0]);
or use a wrapper that forgoes looping and allows you to modify the keys, as such:
function array_change_key(&$array, $search, $replace) {
$keys = array_keys($array);
$values = array_values($array);
// Return FALSE if replace key already exists
if(array_search($replace, $keys) !== FALSE) return FALSE;
// Return FALSE if search key doesn't exists
$searchKey = array_search($search, $keys);
if($searchKey === FALSE) return FALSE;
$keys[$searchKey] = $replace;
$array = array_combine($keys, $values);
return TRUE; // Swap complete
}