Re: changing a key in an array
| From: | David T-G | Date: | Wed, 22 Jan 2003 18:22:58 +0000 |
| Subject: | Re: changing a key in an array | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-132656@lists.php.net to get a copy of this message | ||
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
--
David T-G * There is too much animal courage in
(play) davidtg@justpickone.org * society and not sufficient moral courage.
(work) davidtgwork@justpickone.org -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur
Pbzzhavpngvbaf Qrprapl Npg!