php 两个二维数组重组新数组,数组下标不同

php 两个二维数组重组新数组,数组下标不同,第1张

概述Array([0]=>Array([PosNum]=>27025008[start_time]=>20180328164929[type]=>0)[1]=>Array([PosNum]=>27065075[start_time]=>
Array(    [0] => Array        (            [PosNum] => 27025008            [start_time] => 20180328164929            [type] => 0        )    [1] => Array        (            [PosNum] => 27065075            [start_time] => 20180328164939            [type] => 1        )    [2] => Array        (            [PosNum] => 27065684            [start_time] => 20180329164918            [type] => 2        )    [3] => Array        (            [PosNum] => 27065099            [start_time] => 20180329165556            [type] => 3        ))

 

Array(    [5] => Array        (            [StudentNumber] => 20116161            [PosNum] => 27025008            [judgmenttime] => 20180328164929            [type] => 0        )    [0] => Array        (            [StudentNumber] => 3333号            [PosNum] => 27065075            [judgmenttime] => 20180328164939            [type] => 1        )    [4] => Array        (            [StudentNumber] => 123654789            [PosNum] => 27065684            [judgmenttime] => 20180329164918            [type] => 2        )    [2] => Array        (            [StudentNumber] => 232222222            [PosNum] => 27065099            [judgmenttime] => 20180329165556            [type] => 3        )    [1] => Array        (            [StudentNumber] => 11111111            [PosNum] => 27065188            [judgmenttime] => 20180328165123            [type] => 0        )    [3] => Array        (            [StudentNumber] => 3333333            [PosNum] => 27065066            [judgmenttime] => 20180328162058            [type] => 4        ))

 

  //重组数组        $arr1 = array();        foreach ($res as $k => $v) {            //多的数组            foreach ($result as $ke => $va) {                //少的数组为主                if ($v['PosNum'] == $va['PosNum']) {                    $arr1[$ke]['StudentNumber'] = $va['StudentNumber'];                    $arr1[$ke]['PosNum']        = $va['PosNum'];                    $arr1[$ke]['judgmenttime']  = $v['start_time'];                   // $arr1[$ke][$type[$v['type']]] = $v['start_time'];                    $arr1[$ke]['type'] =$v['type'];                }            }        }

 

总结

以上是内存溢出为你收集整理的php 两个二维数组重组新数组,数组下标不同全部内容,希望文章能够帮你解决php 两个二维数组重组新数组,数组下标不同所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1001516.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-21
下一篇 2022-05-21

发表评论

登录后才能评论

评论列表(0条)

保存