重新排列数组的键PHP

编程入门 行业动态 更新时间:2024-10-07 14:22:11
本文介绍了重新排列数组的键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

本文发布于:2023-11-29 15:07:46,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1646748.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数组   排列   PHP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!