$array['new_key_name'] =& $array['old_key_name'];
unset($array['old_key_name'];
The first line creates a reference to the array.
The second line removes the first reference without removing the second.
See this for more info:
http://www.php.net/manual/en/language.references.unset.php
Regards,
Jason k Larson
David T-G wrote:
Brent, et al --
...and then Brent Baisley said...
% % I had to do something like this not to long ago. Luckily it hit me that % I shouldn't be changing keys, you don't do it in a database, so you % really shouldn't do it in an array.
Hmmm... Good point.
% I ended up adding a "column" to my array that contained the name. Then I % didn't need to change keys and it worked just as well, and easier.
Can you show me how? Currently I have
Array
(
[a1] => Array
(
[k1] => value1
[k2] => value2
)
[a2] => Array
(
[k1] => value1
[k2] => value2
)
)
and now I'll want to add a 'name' thingie (I daren't call it a column :-)
so that I can change it at will ... but where and how do I add it?
Thanks & TIA & HAND
:-D
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php