Cleaning up a PHP array to make it 0 based again

arrays, php

Solution

Use array_values(). It discards all the keys and returns a zero-based array while preserving the relative order of the items.

Problem

I sometimes end up having data in an array that starts far into the array, at position 25 instead of 0 for example. Example: ``` Array ( [16] => Array ( [0] => http://rapidshare.com/files/268123830/hmh.fo3-oks.part01.rar [1] => Marked as illegal ) [17] => Array ( [0] => http://rapidshare.com/files/268124204/hmh.fo3-oks.part02.rar [1] => Marked as illegal ) [18] => Array ( [0] => http://rapidshare.com/files/268127882/hmh.fo3-oks.part03.rar [1] => Marked as illegal ) ) ``` This is because of the user input, not my coding. I need a way to clean up the array to somehow make it 0 based again. The above example should be like this after the cleanup: ``` Array ( [0] => Array ( [0] => http://rapidshare.com/files/268123830/hmh.fo3-oks.part01.rar [1] => Marked as illegal ) [1] => Array ( [0] => http://rapidshare.com/files/268124204/hmh.fo3-oks.part02.rar [1] => Marked as illegal ) [2] => Array ( [0] => http://rapidshare.com/files/268127882/hmh.fo3-oks.part03.rar [1] => Marked as illegal ) ) ``` So I can effectively loop though each array element and output it to the user. Any help on how I would clean up this array would be useful, thanks. :)

Original source