Converting indexed array to normal or simple array

时光毁灭记忆、已成空白 提交于 2019-12-06 23:23:50

问题


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

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

And I need is:

Array(14,19,20);

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


回答1:


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

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

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



来源:https://stackoverflow.com/questions/17980095/converting-indexed-array-to-normal-or-simple-array

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!