时间:2021-07-01 10:21:17 帮助过:13人阅读
$s = array ( 0 => array ( 0 => array ( 0 => '2014-04-11', 'time' => '2014-04-11', 1 => 'BEA01-120N', 'type' => 'BEA01-120N', 2 => 176, 'count' => 176, ), 1 => array ( 0 => '2014-04-11', 'time' => '2014-04-11', 1 => 'BEA21-110N', 'type' => 'BEA21-110N', 2 => 1056, 'count' => 1056, ), ), 1 => array ( 0 => array ( 0 => '2014-04-11', 'time' => '2014-04-11', 1 => 'BEA01-120N', 'type' => 'BEA01-120N', 2 => 192, 'count' => 192, ), 1 => array ( 0 => '2014-04-11', 'time' => '2014-04-11', 1 => 'BEA21-110N', 'type' => 'BEA21-110N', 2 => 960, 'count' => 960, ), ),);function foo($a, $b) { for($i=0; $i Array( [0] => Array ( [0] => BEA01-120N [1] => -16 ) [1] => Array ( [0] => BEA21-110N [1] => 96 ))小计你已经做了,我就偷懒了$s = array (
0 => array (
0 => array (
0 => '2014-04-11', 'time' => '2014-04-11',
1 => 'BEA01-120N', 'type' => 'BEA01-120N',
2 => 176, 'count' => 176,
),
1 => array (
0 => '2014-04-11', 'time' => '2014-04-11',
1 => 'BEA21-110N', 'type' => 'BEA21-110N',
2 => 1056, 'count' => 1056,
),
),
1 => array (
0 => array (
0 => '2014-04-11', 'time' => '2014-04-11',
1 => 'BEA01-120N', 'type' => 'BEA01-120N',
2 => 192, 'count' => 192,
),
1 => array (
0 => '2014-04-11', 'time' => '2014-04-11',
1 => 'BEA21-110N', 'type' => 'BEA21-110N',
2 => 960, 'count' => 960,
),
),
);
function my($a,$b){
foreach($a as $k=>$v){
echo $a[$k]['count']-$b[$k]['count']."
";
}
}
call_user_func_array('my',$s);