Re: Changing the key
| From: | 1LT John W. Holmes | Date: | Thu, 31 Oct 2002 17:31:11 +0000 |
| Subject: | Re: Changing the key | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-122283@lists.php.net to get a copy of this message | ||
> How do I change the key in an array without having a duplicate
key=>$value?
You could maybe use array_flip, change the value, then array_flip again.
Or create your new key=>value and unset() the old one.
$array[$new_key] = $array[$old_key];
unset($array[$old_key]);
---John Holmes...