Posted by Rik on 01/30/07 11:53
David Smithz <dave1900@blueyonder.co.uk> wrote:
>
>> Smithz asked:
>>
>>> if there is a key with value "key2", change this key name so it is =
>>> instead
>>> "key number 2" (while maintaining the keys value).
>> Geoff said:
>> $array['key number 2']=3D$array['key2'];
>> //optionally
>> unset($array['key2']);
>
> Thanks for this Geoff. Works. However does lose the ordering of my =
> array. Is
> there a way of maintaining the order as I guess the above puts in a ne=
w
> element, and then just removes the old one.
>
> How can I as well maintain the order.
http://nl2.php.net/manual/en/function.array-splice.php
-- =
Rik Wasmus
[Back to original message]
|