Ask! Php array! The previously created array is indexed by, 2, and 3, because there are duplicate values in it, I used the array_unique function, so that the duplicate values are removed, but the index cannot be consecutive, I wonder if there is a way to re-sort indexes like 0, 1, and 2 in the current order? ------ Solution -------------------- $ newArrayarray (); $ i0; foreach ($ ask! Php array!
The previously created array is indexed by, 2, and 3, because there are duplicate values in it, I used the array_unique function, so that the duplicate values are removed, but the index cannot be consecutive, I wonder if there is a way to re-sort indexes like 0, 1, and 2 in the current order?
------ Solution --------------------
$ NewArray = array ();
$ I = 0;
Foreach ($ oldArray as $ v ){
$ NewArray [$ I ++] = $ v;
}
Unset ($ oldArray );