array_merge vs array_value for resetting array index
Posted
by Jamex
on Stack Overflow
See other posts from Stack Overflow
or by Jamex
Published on 2010-05-30T23:33:01Z
Indexed on
2010/05/30
23:42 UTC
Read the original article
Hit count: 278
I have 1 array that I want to re-index. I have found that both array_values
and array_merge
functions can do the job (and I don't need 2 arrays for the array_merge
function to work).
Which is faster for a very large array? I would benchmark this, but I don't know how and don't have the large array yet.
Before re-index:
Array
(
[0] => AB
[4] => EA
[6] => FA
[9] => DA
[10] => AF
)
After re-index:
Array
(
[0] => AB
[1] => EA
[2] => FA
[3] => DA
[4] => AF
)
© Stack Overflow or respective owner