PHP删除数组中某个元素后,键标如何重新排序?
例如:Array ( [0] => 0 [1] => 1 [2] => 2 [3] => 3 [4] => 4 [5] => 5)键值和键标一一对应。如果删除键值4,变为
Array ( [0] => 0 [1] => 1 [2] => 2 [3] => 3 [5] => 5);
如何得到Array ( [0] => 0 [1] => 1 [2] => 2 [3] => 3 [4] => 4 [4] => 5);达到目的:改变删除数据后面的键标?
答案:$arr=array_merge($arr); 这个函数可以给数组重新进行排序
转载:https://zhidao.baidu.com/question/873323332503786172.html