【问题标题】:How to combine or merge multiple values inside the single array? [duplicate]如何在单个数组中组合或合并多个值? [复制]
【发布时间】:2019-08-15 20:25:59
【问题描述】:

我有一个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
    )

感谢回答

【问题讨论】:

标签: php arrays


【解决方案1】:
$array = array("a" => "moon", "star", "b" => "moon", "star", "sky");

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

【讨论】:

  • 这个问题被标记为骗子,你为什么要回答?
猜你喜欢
  • 2014-03-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-09-10
  • 1970-01-01
  • 2015-09-28
  • 2022-08-07
  • 2013-03-23
相关资源
最近更新 更多