Re: changing a key in an array

From: Date: Thu, 23 Jan 2003 19:16:35 +0000
Subject: Re: changing a key in an array
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-132885@lists.php.net to get a copy of this message
Jason, et al -- ..and then David T-G said... % % ...and then Jason k Larson said... % % % % If you are looking for something as simple as an index or key rename That was it, indeed, but $t = array("t1" => "temp1", "t2" => "temp2" ) ; $f = array("f1" => "foo1", "f2" => "foo2" ) ; $a['t'] = $t ; $a['f'] = $f ; $a['n'] =& $a['t'] ; unset($a['t']) ; print_r($a) ; yields Array ( [f] => Array ( [f1] => foo1 [f2] => foo2 ) [n] => Array ( [t1] => temp1 [t2] => temp2 ) ) instead of having 'n' before 'f' (in the old 't' spot) as desired. So I'm back to the beginning and to funky array wrappers again... I think these surfers will just see their baskets in different order after a rename :-) Thanks to all & 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!

« previous php.general (#132885) next »