Aug 07, 2013, by admin
Sometimes you need to re-index a numerically indexed array after removing elements from it. Actually if you remove one or more elements from the middle of an integer-indexed array with the unset() function. But PHP doesn’t automatically re-index the array for you. As a result, you end up with an array containing non-sequential index numbers. It’s generally a good idea to close up these “holes” in the array indexing sequences to eliminate the possibility of them skewing your array calculation. The simplest way to do this is to retrieve the list of array values with the array_values() function, and then reassign this list back to the original array variable. This re-indexes the array and also closes up the gaps.
Running code to re-index array:
Hope this post will be helpful to get more post like the page Bugtreat Technologies