Array push as the first index PHP

前端 未结 3 1016
太阳男子
太阳男子 2021-01-31 14:37

I have an array that doesn\'t use the 0 index. The array starts from 1,2,3. So I would like to add to the array. I tried do array_push($array, \"Choose City\"), but

3条回答
  •  感情败类
    2021-01-31 14:56

    If you know that Index 0 is not used you can simply assign it:

    $array[0] = "Choose City";
    

提交回复
热议问题