Re: changing a key in an array

From: Date: Thu, 23 Jan 2003 18:34:57 +0000
Subject: Re: changing a key in an array
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-132881@lists.php.net to get a copy of this message
Jason, et al -- ..and then Jason k Larson said... % % If you are looking for something as simple as an index or key rename Yep. % function it can be done and without making any copies of the array or % object etc by: Cool! % % $array['new_key_name'] =& $array['old_key_name']; % unset($array['old_key_name']; *blink* Oh, cool. I didn't know why I didn't think of that! I'm quite used to dereferencing in perl, and this is the same concept. % % The first line creates a reference to the array. % The second line removes the first reference without removing the second. Of course. Perfect! Now to go and try it ;-) % % See this for more info: % http://www.php.net/manual/en/language.references.unset.php Thanks; I sure will. % % Regards, % Jason k Larson Thanks & 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 (#132881) next »