Reply to Re: Replacing key in associative array

Your name:

Reply:


Posted by David Smithz on 01/30/07 10:44

> 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']=$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 new
element, and then just removes the old one.

How can I as well maintain the order.

thanks

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация