PHP two-dimensional array de-weight
Method one: reducing dimension to weight
if (! $isPidArrKey) { //Dimension de-weight $temp = Array (); foreach ($tmp as $k = + $v) { $v = Implode (', ', $v); $temp [] = $v; } $temp = Array_unique ($temp); foreach ($temp as $k = + $v) { $temp [$k] = Explode (",", $v); } $tmp = $temp; }
Method Two: Using a third array to remove weight
$IDSTMP = Array (); $com = new cachecombusiness (); foreach ($proInfo as $key + $value) { foreach ($comInfo as $k + = $v) { if ($value [' cid '] = = $k) { //$v alue[' cid '] =; $comBusInfo = $com->getmore (Array ($value [' CID ']); if (!empty ($comBusInfo)) { $value [' qq '] = $comBusInfo [0][' Contactarr '] [' QQ ']; } if (In_array ($value [' pid '], $idsTmp)) { continue; } $IDSTMP [] = $value [' pid ']; if ($isPidArrKey) { $tmp [$key] = Array_merge ($value, $v); } else { $tmp [] = Array_merge ($value, $v); } } } }
http://www.bkjia.com/PHPjc/1056013.html www.bkjia.com true http://www.bkjia.com/PHPjc/1056013.html techarticle php Two-dimensional array de-weight method one: reduced dimension de-weight if (! $isPidArrKey) {//Dimension de-weight $temp = Array (); foreach ($tmp as $k = $v) {$v = Implode (,, $v); $temp [] = $v; } $temp = Array_u ...