Resetting an Array Index in PHP
- 16 April, 2010 -
- Php -
- Tags : array, php
- 0 Comments
After filtering an array indices are removed from the array resulting in errors while trying to loop over the index. Therefore, one needs to reset then index so that it follows a logical order (1,2,3..) instead of (1,3,6,7…). Luckily, PHP doesn’t have a defined method to do this, but it does have another method that will do this for you although it is intended for another purpose.
$myArray = array_merge($myArray);