Reply to Removing elements from an array -- key sequence ...

Your name:

Reply:


Posted by CYBER on 03/19/06 22:56

Hello

I'm looking for the fastest way to remove an element from an array
so the sequence of keys is not changed.

For example
when i remove an element from this array

$tab = Array('a', 'b', 'c');

unset($tab[1])


php gives me this result

Array
(
[0] => a
[2] => c
)


And i would like to get

Array
(
[0] => a
[1] => c
)


I know i can use this to fix the problem.

$Tab = array_values($Tab);


But is this the most efficient solution ?

What happens when you try to use array_values on an array that contains
references to other variables ?


Thank you.

[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

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