嗨,我的阵列看起来像这样:
Array ( [5] => 6 [6] => 7 [8] => 9 [10] => 11 [13] => 13 [22] => 23 [23] => 24 [24] => 25 [25] => 26 [29] => 30 [37] => 38 [38] => 39 [41] => 42 [44] => 45 [47] => 48 [48] => 49 [53] => 54 [57] => 58 [58] => 59 [60] => 61 [62] => 63 [68] => 69 [70] => 71 [74] => 75 )
如何让它看起来像这样:
array([0] => 6 [1] => 7 [2] => 9 [3] => 11 [4] => 13 etc ) ?
答案 0 :(得分:0)
我认为您正在寻找array_values()
的原生功能:
$array = array( 5 => 6,
6 => 7,
8 => 9,
10 => 11,
13 => 13,
22 => 23,
23 => 24,
24 => 25,
25 => 26,
29 => 30,
37 => 38,
38 => 39,
41 => 42,
44 => 45,
47 => 48,
48 => 49,
53 => 54,
57 => 58,
58 => 59,
60 => 61,
62 => 63,
68 => 69,
70 => 71,
74 => 75
);
print_r(array_values($array));
给你:
Array
(
[0] => 6
[1] => 7
[2] => 9
[3] => 11
[4] => 13
[5] => 23
[6] => 24
[7] => 25
[8] => 26
[9] => 30
[10] => 38
[11] => 39
[12] => 42
[13] => 45
[14] => 48
[15] => 49
[16] => 54
[17] => 58
[18] => 59
[19] => 61
[20] => 63
[21] => 69
[22] => 71
[23] => 75
)