时间:2021-07-01 10:21:17 帮助过:26人阅读
$a = array (
0 =>
array (
'cust_no' => '310F6 1VA5A',
'lotno' => '2X15',
'count' => '0',
),
1 =>
array (
'cust_no' => '310F6 1VA5A',
'lotno' => '2Z15',
'count' => '16',
),
);
$b = array (
0 =>
array (
'cust_no' => '310F6 1VA5A',
'lotno' => '2X15',
'count' => '0',
),
1 =>
array (
'cust_no' => '310F6 1VA5A',
'lotno' => '2Z15',
'count' => '32',
),
2 =>
array (
'cust_no' => '310F6 1VA5A',
'lotno' => '3528',
'count' => '80',
),
);
foreach($b as $i=>$v) {
print_r($v);
if(isset($a[$i]) && $v['cust_no'] == $a[$i]['cust_no'] && $v['lotno'] == $a[$i]['lotno']) {
echo "update table sql\n";
}else echo "insert table sql\n";
}