/**
* 合并数组
* zhangming 2014-07-24
* @param unknown_type $arrayMerge 要合并的数组源
* @param unknown_type $keyName 键名称
* @param unknown_type $valueName 新增加数组元素的键值
* @param unknown_type $newArray 被合并的数组
*/
public function ArrMerge($arrayMerge, $keyName, $valueName, $newArray = Array()) {
foreach($arrayMerge as $key => $value) {
if ($value[$valueName] != '') {
$newArray[$value[$keyName]][$valueName] = $value[$valueName];
}
else {
$newArray[$value[$keyName]][$valueName] = '';
}
}
return $newArray;
* 合并数组
* zhangming 2014-07-24
* @param unknown_type $arrayMerge 要合并的数组源
* @param unknown_type $keyName 键名称
* @param unknown_type $valueName 新增加数组元素的键值
* @param unknown_type $newArray 被合并的数组
*/
public function ArrMerge($arrayMerge, $keyName, $valueName, $newArray = Array()) {
foreach($arrayMerge as $key => $value) {
if ($value[$valueName] != '') {
$newArray[$value[$keyName]][$valueName] = $value[$valueName];
}
else {
$newArray[$value[$keyName]][$valueName] = '';
}
}
return $newArray;
}
foreach ($amountChargeMoneyArr as $k => $v) {
$amountChargeMoneyNewArr[$v['moneyId']] = $v;
}
/*//var_dump($amountChargeMoneyNewArr);
foreach ($deductsArr as $key => $value) {
//$amountChargeMoneyNewArr[$value['moneyId']]['deductMoney'] = 3333333333333333333333;
//if ($value['deductMoney'] != '') {
$amountChargeMoneyNewArr[$value['moneyId']]['deductMoney'] = $value['deductMoney'];
}*/
$list = $this->ArrMerge($deductsArr, 'moneyId', 'deductMoney', $amountChargeMoneyNewArr);
var_dump($list);