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]);
But this will move the key to the end of the array.
Is there some elegant way to change the key without changing the order?
(PS: This question is just out of conceptual interest, not because I need it anywhere.)