changing a key in an array
| From: | David T-G | Date: | Tue, 21 Jan 2003 13:47:39 +0000 |
| Subject: | changing a key in an array | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-132397@lists.php.net to get a copy of this message | ||
Hi, all --
If I have an associative array
Array
(
[t] => Array
(
[t1] => temp1
[t2] => temp2
)
[f] => Array
(
[f1] => foo1
[f2] => foo2
)
)
and I want to change the key 't' to, say, 'tmp', is there a way to change
it or do I have to use the brute force
$a[tmp] = $a[t] ;
unset $a[t] ;
approach?
I expect that, however it's done, it works the same way on just a 1-d
assoc array like
Array
(
[t1] => temp1
[t2] => temp2
)
but in particular I have the 2-d array case that I need to play with
today.
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!