You are here: how to replace an array key and keep the position? « PHP Language « IT news, forums, messages
how to replace an array key and keep the position?

Posted by Marc Bauer on 10/04/07 21:51

Hi

i'd like to replace an array key, but i cannot figure out how this could
work.

As an example this array:

$array1 = array('key1' => 'value1', 'key2' => 'value2', 'key3' =>
'value3' );

Now, i'd like to replace the 'key2' => 'value2' with 'key4' => 'value4' and
the array should look like:

$array1 = array('key1' => 'value1', 'key4' => 'value4', 'key3' =>
'value3' );

The order of the keys is important... so i must replace on the same array
position.

Regards
Marc

 

Navigation:

[Reply to this 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

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