重建索引数值数组键 [英] Re-index numeric array keys

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

问题描述

我有一个使用爆炸()功能建立了一个数组,但看到如何我使用它与随机/动态数据,我看到的指标保持变化:

阵列

    [2] =>标题:表哥苏塞克斯整套祝福它老人家之前热烈一点。
    [3] =>摘录:测试
    [4] =>类别:会员
    [5] =>标签:小,在此之前,整个

我需要从0开始总是被订购的数组。我正在与不同的数据进行测试,有时从0开始,并与其他测试中,它开始于不同的号码。
我研究并在阵列来从零开始但似乎只适用于用户具体案件。在code我使用构建阵列可以在这里看到:
<一href=\"http://stackoverflow.com/a/10484967/1183323\">http://stackoverflow.com/a/10484967/1183323

我怎样才能做到这一点?


解决方案

  $ your_new_array = array_values​​($ your_old_array);

I have an array that is built using the explode() function, but seeing how i'm using it with random/dynamic data, i see that the indexes keep changing:

Array
(
    [2] => Title: Warmly little before cousin sussex entire set Blessing it ladyship.
    [3] => Snippet: Testing
    [4] => Category: Member
    [5] => Tags: little, before, entire
)

I need the array to be ordered starting at 0 always. I am testing with different data and sometimes it starts at 0, and with other tests it begins at different numbers. I researched and came across Array starting at zero but it seems that only applied to that users specific case. The code i'm using to build the array can be seen here: http://stackoverflow.com/a/10484967/1183323

How can i do this?

解决方案

$your_new_array = array_values($your_old_array);

这篇关于重建索引数值数组键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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