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]
|