du27271 2018-06-14 18:26
浏览 611
已采纳

在php中合并重复的数组值

I have a multidimensional array like:

Array
(
    [0] => Array
        (
            [division] => Mymensingh
            [A] => 1
        )    
    [1] => Array
        (
            [division] => Dhaka
            [A] => 5
        )
    [2] => Array
        (
            [division] => Mymensingh
            [B] => 2
            [C] => 5
        )
)

Need to find the same value of division index and merge them in one array. May be there is PHP functions to do this. I could not figure it out. Now from this array I want the output as:

Array
    (
        [0] => Array
            (
                [division] => Mymensingh
                [A] => 1
                [B] => 2
                [C] => 5
            )    
        [1] => Array
            (
                [division] => Dhaka
                [A] => 5
            )
    )

Index of sub arrays can be different and also can be different numbers of.

  • 写回答

2条回答

      报告相同问题?

      相关推荐 更多相似问题

      悬赏问题

      • ¥15 使用Labwindows/CVI程控万用表时自动切换量程
      • ¥15 Matlab修改xml参数后允许不了exe文件
      • ¥15 Java的问题解答一下呗
      • ¥20 怎么将vs中的程序同步到sql中的表中
      • ¥15 用flask框架接收前端上传的文本文件后怎么读取该文件
      • ¥15 有没有嵌入式ubuntu的朋友
      • ¥50 diddler Burp Suite
      • ¥20 关于UE5.1的问题,求专家解答!
      • ¥30 关于#爬虫#的问题:百度为您找到相关结果约100,000,000个 但只展现70页 有没有可能提取出来全部的搜索结果
      • ¥40 IIS部署API,弄了几天没弄出来,希望带佬远程帮我弄一下,有偿