开发者

How do I reassign array positions in php? [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplicate:

How to re-index the values of an array in PHP?

I'm using several php functions to carry c开发者_StackOverflow中文版ertain data over through an array, and through the process I get arrays that print_r like the following:

Array ([0] => 35 [4] => 36 [6] => 34)

What do I have to do if I want to reorder it back to the following? (I use a for statement and need the keys to be in consecutive order starting from 0 again)

Array ([0] => 35 [1] => 36 [2] => 34)


$array = array_values($array);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜