好,所以我有以下数组:
0 - 208533
1 - 208523
2 - 208522
3 - 208572
4 - 208518
5 - 208501
6 - 208534
7 - 208499
我需要的是一个快速函数,它将数组键设置为1而不是0.
例如: 1 - 208533 等
有什么想法吗?
谢谢!
答案 0 :(得分:3)
一个快速的方法是:
array_unshift($array, null); // inject a dummy value at beginning
unset($array[0]); // unset the dummy value, the rest of the keys are preserved