In PHP, you can fill an array without referring to the actual index. $newArray = array(); foreach($var in ...
stackoverflow.com