SCook Posted August 23, 2007 Share Posted August 23, 2007 Hi gang, I would like to rename a key in an array from x to y for example, how is this done? Link to comment https://forums.phpfreaks.com/topic/66277-renaming-an-array-key/ Share on other sites More sharing options...
btherl Posted August 23, 2007 Share Posted August 23, 2007 $a['new_key'] = $a['old_key']; unset($a['old_key']); Because php uses copy on write, this will not make a second copy of the data. Link to comment https://forums.phpfreaks.com/topic/66277-renaming-an-array-key/#findComment-331496 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.