php – 重新索引数字数组键

前端之家收集整理的这篇文章主要介绍了php – 重新索引数字数组键前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个使用explode()函数构建的数组,但是看到我如何使用随机/动态数据,我看到索引不断变化:
  1. Array
  2. (
  3. [2] => Title: Warmly little before cousin sussex entire set Blessing it ladyship.
  4. [3] => Snippet: Testing
  5. [4] => Category: Member
  6. [5] => Tags: little,before,entire
  7. )

我需要从0开始的数组.我正在测试不同的数据,有时它从0开始,其他测试开始于不同的数字.
我研究并发现了Array starting at zero,但似乎只适用于用户的具体情况.我用来构建数组的代码可以在这里看到:
https://stackoverflow.com/a/10484967/1183323

我该怎么办?

  1. $your_new_array = array_values($your_old_array);

猜你在找的PHP相关文章