阵推为第一指标PHP [英] Array push as the first index PHP

查看:89
本文介绍了阵推为第一指标PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有不使用0的索引的数组。该阵列从1,2,3开始。所以我想添加到阵列中。我试着做 array_push($阵选择城市),但在这种情况下,在数组的结尾结束,与数组索引4。

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 this ends up at the end of the array, with array index 4 in this case.

如何才能将其设置为数组的索引0?

How can I set it to be the array index 0?

推荐答案

<一个href=\"http://php.net/manual/en/function.array-unshift.php\">http://php.net/manual/en/function.array-unshift.php

array_unshift($array, "Choose City")

或者你可以做手工

or you can do it manually

这篇关于阵推为第一指标PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆