将PHP中的多维数组与重复条目结合使用

时间:2014-10-01 16:42:38

标签: php arrays multidimensional-array

我有一系列订单。我需要搜索超过1个订单的客户并将它们合并。

订购数组如下:

$orders = Array (
    [0] => Array (
        [address] => Array (
            [name] => Random Name
            [street1] => 975 Vintage Ct
            [city] => Rio Vista
            [state] => CA
            [zip] => 94571-9780
            )
        [skus] => Product-1
        [carrier] => USPS
        [service] => First
    )
    [1] => Array (
        [address] => Array (
            [name] => Random Name
            [street1] => 975 Vintage Ct
            [city] => Rio Vista
            [state] => CA
            [zip] => 94571-9780
        )
        [skus] => Product-1
        [carrier] => USPS
        [service] => First
    )
    [2] => Array (
        [address] => Array (
            [name] => Different Name
            [street1] => 6516 Northern Red Oak Dr
            [city] => Mint Hill
            [state] => NC
            [zip] => 28227-4629
        )
        [skus] => Product-1
        [carrier] => USPS
        [service] => First
    )
)

我希望找到超过1个订单的客户,并将它们组合起来:

$orders = Array (
    [0] => Array (
        [address] => Array (
            [name] => Random Name
            [street1] => 975 Vintage Ct
            [city] => Rio Vista
            [state] => CA
            [zip] => 94571-9780
            )
        [skus] => Product-1, Product-1
        [carrier] => USPS
        [service] => First
    )
    [1] => Array (
        [address] => Array (
            [name] => Different Name
            [street1] => 6516 Northern Red Oak Dr
            [city] => Mint Hill
            [state] => NC
            [zip] => 28227-4629
        )
        [skus] => Product-1
        [carrier] => USPS
        [service] => First
    )
)

0 个答案:

没有答案