本文介绍了重新排列数组的键PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这个数组:
阵列([15] => 13.1[16] =>马克一个答案[19] =>你看与显示HELP三角旗高速公路的硬路肩车。这意味着驱动器是最有可能被[20] =>培训了残疾人急救[21] =>一位外国游客[22] =>救援人员巡逻[25] => DES S15,HC r278);我如何得到它的键值从0排序?得到这个:我知道有一个功能,但我的头被烧掉,排序功能不适合我的需要,因为他们重新排列值,我需要他们是保守的。
阵列([0] => 13.1[1] =>马克一个答案[2] =>你看与显示HELP三角旗高速公路的硬路肩车。这意味着驱动器是最有可能被[3] =>培训了残疾人急救[4] =>一位外国游客[5] =>救援人员巡逻[6] => DES S15,HC r278);解决方案
我认为你正在寻找 array_values
$ ARR = array_values($ ARR);
i have this array:
Array ( [15] => 13.1 [16] => Mark one answer [19] => You see a car on the hard shoulder of a motorway with a HELP pennant displayed. This means the driver is most likely to be [20] => a disabled person first aid trained [21] => a foreign visitor [22] => a rescue patrol person [25] => DES s15, HC r278);How do i get it to sort the keys from 0? to get this: i know there is a function, but my head is burned, the sort function doesn't fit my needs since they rearrange values, and i need them to be conserved.
Array ( [0] => 13.1 [1] => Mark one answer [2] => You see a car on the hard shoulder of a motorway with a HELP pennant displayed. This means the driver is most likely to be [3] => a disabled person first aid trained [4] => a foreign visitor [5] => a rescue patrol person [6] => DES s15, HC r278);解决方案
I think you're looking for array_values
$arr = array_values($arr);
更多推荐
重新排列数组的键PHP
发布评论