-1

例如,我有以下数组:

$arr[0] = "1"
$arr[7] = "p"
$arr[10] = "c"
$arr[12] = 'k"

如何将其转换为:

$arr[0] = "1"
$arr[1] = "p"
$arr[2] = "c"
$arr[3] = 'k"
4

1 回答 1

1

像这样:

$arr = array_values($arr);

http://www.php.net/manual/en/function.array-values.php

于 2013-07-20T14:24:02.070 回答