如何在单个数组中合并或合并多个值?

时间:2019-03-25 14:47:09

标签: php arrays

我有一个array值。在array内部,有一些multiple数据,但是如何combine or merge这些multiple records。 单个数组中的某些值是倍数。如何合并这些?

    Array
    (
    [0] => plxliupp
    [1] => plxliupp
    [2] => dg_w12
    [3] => col4312
    [4] => Iphone6s
    [5] => Ndry_milk
    [6] => smj7
    [7] => ovn 02 o3
    [8] => allwin6406f
    )

删除multiples值之后。 array这样

    Array
    (
    [0] => plxliupp
    [1] => dg_w12
    [2] => col4312
    [3] => Iphone6s
    [4] => Ndry_milk
    [5] => smj7
    [6] => ovn 02 o3
    [7] => allwin6406f
    )

感谢回答

1 个答案:

答案 0 :(得分:1)

$array = array("a" => "moon", "star", "b" => "moon", "star", "sky");

// Deleting the duplicate items
$result = array_unique($array);
print_r($result);