数组合并问题(已更新) 本帖最后由 lazygc520 于 2014-04-08 16:17:15 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 $res = array();foreach($ar as $t) { $k = join('_', array($t['arr_time'], $t['c_type'], $t['snp'])); $res[$k][] = $t;}print_r($res);得Array( [30/03/2014 9:00_D22_15] => Array ( [0] => Array ( [cust_no] => 237109S92B [hi_no] => MEC38-431 [arr_time] => 30/03/2014 9:00 [totals] => 15 [ch_date] => 26/03/2014 0:00 [snp] => 15 [mount] => 1 [c_type] => D22 ) [1] => Array ( [cust_no] => 237109S92B [hi_no] => MEC38-431 [arr_time] => 30/03/2014 9:00 [totals] => 15 [ch_date] => 26/03/2014 0:00 [snp] => 15 [mount] => 1 [c_type] => D22 ) ) [30/03/2014 19:00_X11M_15] => Array ( [0] => Array ( [cust_no] => 237033AW0A [hi_no] => BEM330-500 [arr_time] => 30/03/2014 19:00 [totals] => 15 [ch_date] => 26/03/2014 0:00 [snp] => 15 [mount] => 1 [c_type] => X11M ) [1] => Array ( [cust_no] => 237033AW0A [hi_no] => BEM330-500 [arr_time] => 30/03/2014 19:00 [totals] => 45 [ch_date] => 26/03/2014 0:00 [snp] => 15 [mount] => 3 [c_type] => X11M ) [2] => Array ( [cust_no] => 237033AW0A [hi_no] => BEM330-500 [arr_time] => 30/03/2014 19:00 [totals] => 45 [ch_date] => 26/03/2014 0:00 [snp] => 15 [mount] => 3 [c_type] => X11M ) ) [1/04/2014 19:00_X11M_15] => Array ( [0] => Array ( [cust_no] => 237033AW0A [hi_no] => BEM330-500 [arr_time] => 1/04/2014 19:00 [totals] => 45 [ch_date] => 26/03/2014 0:00 [snp] => 15 [mount] => 3 [c_type] => X11M ) ))接下来该怎么做,你应该会的 Can't create/write to file '#sql_970_0.MYD' (Errcode: 17) 从头学习Drupal--基本架构二 php读取xml 给js解析的问题 麻烦高手帮忙看一下代码,在线等待 我的PHP在命令行下无法运行EXEC()函数 php与sqlsever连接时出现的问题 删除创建超时的文件 求助!!我想知道一个网站是如何编的 学PHP到哪找工作最好?哪里工资最高 大家建议一下,我现在该学些什么啊??? apache每天宕机一次 如何读取text文件,显示原样格式?
foreach($ar as $t) {
$k = join('_', array($t['arr_time'], $t['c_type'], $t['snp']));
$res[$k][] = $t;
}
print_r($res);
得Array
(
[30/03/2014 9:00_D22_15] => Array
(
[0] => Array
(
[cust_no] => 237109S92B
[hi_no] => MEC38-431
[arr_time] => 30/03/2014 9:00
[totals] => 15
[ch_date] => 26/03/2014 0:00
[snp] => 15
[mount] => 1
[c_type] => D22
) [1] => Array
(
[cust_no] => 237109S92B
[hi_no] => MEC38-431
[arr_time] => 30/03/2014 9:00
[totals] => 15
[ch_date] => 26/03/2014 0:00
[snp] => 15
[mount] => 1
[c_type] => D22
) ) [30/03/2014 19:00_X11M_15] => Array
(
[0] => Array
(
[cust_no] => 237033AW0A
[hi_no] => BEM330-500
[arr_time] => 30/03/2014 19:00
[totals] => 15
[ch_date] => 26/03/2014 0:00
[snp] => 15
[mount] => 1
[c_type] => X11M
) [1] => Array
(
[cust_no] => 237033AW0A
[hi_no] => BEM330-500
[arr_time] => 30/03/2014 19:00
[totals] => 45
[ch_date] => 26/03/2014 0:00
[snp] => 15
[mount] => 3
[c_type] => X11M
) [2] => Array
(
[cust_no] => 237033AW0A
[hi_no] => BEM330-500
[arr_time] => 30/03/2014 19:00
[totals] => 45
[ch_date] => 26/03/2014 0:00
[snp] => 15
[mount] => 3
[c_type] => X11M
) ) [1/04/2014 19:00_X11M_15] => Array
(
[0] => Array
(
[cust_no] => 237033AW0A
[hi_no] => BEM330-500
[arr_time] => 1/04/2014 19:00
[totals] => 45
[ch_date] => 26/03/2014 0:00
[snp] => 15
[mount] => 3
[c_type] => X11M
) ))
接下来该怎么做,你应该会的