As response to Ella's note:
$array[0] = 'record1';
$array[9] = 'record2';
$array[15] = 'record3';
That is ordered way easier AND faster with array_values().
array_reverse twice is unnecessary. Once array_values and all values will be saved in new keys