转换索引数组正常或简单的数组 [英] Converting indexed array to normal or simple array

查看:153
本文介绍了转换索引数组正常或简单的数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图索引数组转换为普通阵列。基本上,得到的是:

I am trying to convert indexed array to normal array. Basically what get is:

Array ( [0] => 14 [1] => 19 [2] => 20 )

和我需要的是:

Array(14,19,20);

我尝试了谷歌,但发现没有信息。我觉得这种功能不可用在PHP中,有没有?请让我知道!

I tried over Google but not information found. I think this kind of function isn't available in PHP, is there any? please let me know!

谢谢,
阿西夫

Thanks, Asif

推荐答案

您正在追影:结果
无论你表现出的数组是相等的。

You're chasing shadows:
Both of the arrays you have shown are equal.

有没有这样的事情在PHP中没有索引的数组。

There is no such thing as an unindexed array in PHP.

但如果你真的希望确保,使用 $ newArray = array_values​​($数组)

But if you really want to be sure, use $newArray = array_values($array)

这篇关于转换索引数组正常或简单的数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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