Reset 0 array key

hello forums

I have this array:

[0] => 103
[1] => 106
[2] => 113
[3] => 121

I want it to be like this:

[1] => 103
[2] => 106
[3] => 113
[4] => 121

Any ideas?

Thanks

How about this :slight_smile:

$array = array_values(array_unshift($array, null)); unset($array[0]);

Best regards, George

There’s also the option of


$array = array_combine(range(1, count($array)), $array);

Both mine and GOPalmer’s will get the job done. (: