我使用array_uniqe
从数组(列表1)中删除了dupliactes,但如何将其输出(列表2)的基数重新计算为[0-x](列表3):
列表1:
array (size=24)
0 => string '2013-09-18' (length=10)
1 => string '2013-09-18' (length=10)
2 => string '2013-09-18' (length=10)
3 => string '2013-09-18' (length=10)
4 => string '2013-09-19' (length=10)
5 => string '2013-09-19' (length=10)
6 => string '2013-09-19' (length=10)
7 => string '2013-09-19' (length=10)
8 => string '2013-09-19' (length=10)
9 => string '2013-09-19' (length=10)
10 => string '2013-09-19' (length=10)
11 => string '2013-09-20' (length=10)
12 => string '2013-09-20' (length=10)
13 => string '2013-09-20' (length=10)
14 => string '2013-09-20' (length=10)
15 => string '2013-09-21' (length=10)
16 => string '2013-09-21' (length=10)
17 => string '2013-09-21' (length=10)
18 => string '2013-09-21' (length=10)
19 => string '2013-09-21' (length=10)
20 => string '2013-09-21' (length=10)
21 => string '2013-09-22' (length=10)
22 => string '2013-09-22' (length=10)
23 => string '2013-09-22' (length=10)
列表2:
array (size=5)
0 => string '2013-09-18' (length=10)
4 => string '2013-09-19' (length=10)
11 => string '2013-09-20' (length=10)
15 => string '2013-09-21' (length=10)
21 => string '2013-09-22' (length=10)
列表3:
array (size=5)
0 => string '2013-09-18' (length=10)
1 => string '2013-09-19' (length=10)
2 => string '2013-09-20' (length=10)
3 => string '2013-09-21' (length=10)
4 => string '2013-09-22' (length=10)
最佳答案
$list3 = array_values($list2);