Add Me!Close Menu Navigation
Add Me!Open Categories Menu

Resetting an Array Index in PHP

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);
Posted By Nick Holdren

Leave a Reply