从unassociated数组中删除非唯一的PHP数组值

时间:2016-06-11 19:15:14

标签: php arrays

以下代码:

Array
(
    [0] => one
    [1] => two
    [2] => three
    [3] => two
    [4] => four
)

Array
(
    [0] => one
    [1] => two
    [2] => three
    [4] => four
)

产生以下内容:

Array
(
    [0] => one
    [1] => two
    [2] => three
    [3] => four
)

如何保留连续的数组索引并生成以下内容:

struct

2 个答案:

答案 0 :(得分:1)

再添加一行 getdefaultlocale

答案 1 :(得分:0)

您可以使用array_values

查看手册:https://secure.php.net/manual/en/function.array-values.php