Re: Ideas on modifying array keys
| From: | Michal Migurski | Date: | Wed, 18 Feb 2004 17:27:59 +0000 |
| Subject: | Re: Ideas on modifying array keys | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-178141@lists.php.net to get a copy of this message | ||
>The only way I can think of is to loop through the array, copying array
>values to new keys, and unsetting the old key.
Yeah, that's pretty much it:
foreach(array_keys($array) as $old_key) {
$array[new_key($old_key)] = $array[$old_key];
unset($array[$old_key]);
}
---------------------------------------------------------------------
michal migurski- contact info and pgp key:
sf/ca http://mike.teczno.com/contact.html