我有一个数组(sizeofarray = 5)
$city[0] = 'Newyork'
$city[1] = 'Paris'
$city[2] = 'Paris'
$city[3] = 'Newyork'
$city[4] = 'Amsterdam'
(sizeofarray = 5)
我使用 array_unique() 来删除欺骗并得到了这个:
$city[0] = 'Newyork'
$city[1] = 'Paris'
$city[4] = 'Amsterdam'
(sizeofarray = 3)
但现在我想要这个:
$city[0] = 'Newyork'
$city[1] = 'Paris'
$city[2] = 'Amsterdam'
(sizeofarray = 3)
有什么功能可以实现吗?