Re: [PHP] Ideas on modifying array keys

2004-02-18 Thread Michal Migurski
>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_k

[PHP] Ideas on modifying array keys

2004-02-18 Thread Gerard Samuel
Im looking for the fastest way to modify array keys. For example, changing -> $foo['hello_world'] = 'HELLO WORLD'; to $foo['hello'] = 'HELLO WORLD'; The only way I can think of is to loop through the array, copying array values to new keys, and unsetting the old key. Thanks for any insight you m