如何数组键从 1 而不是 0 开始?

2022-01-24 00:00:00 arrays range php

如何从 1 而不是 0 开始范围的数组,代码如下所示:

How do I start the array of a range at 1 instead of 0, Code looks like this:

    $numbers = range(0, 14);

我试过了,但这并没有解决我的问题

I tried this but that does not solve my problem

    $numbers = range(0, 14);

推荐答案

你也可以去:

$numbers = range(0, 14);

array_unshift($numbers,"");
unset($numbers[0]);

相关文章