Re: Ideas on modifying array keys

From: Date: Wed, 18 Feb 2004 17:03:40 +0000
Subject: Re: Ideas on modifying array keys
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-178136@lists.php.net to get a copy of this message
You might be able to create some function that uses a combination of array_keys(), array_values(), and array_combine() to do what you want. Check the manual at http://www.php.net/array for more information on these functions. Gerard Samuel wrote:
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 may provide...


« previous php.general (#178136) next »